When I trigger the build pipeline of my application, I get a failed to execute a goal error. However, when I build this application locally, I don't get such exception. When I build via GitLab only I get into this situation.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project sample-app: Execution default-clean of goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean failed: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-clean-plugin:jar:2.5 -> org.apache.maven:maven-plugin-api:jar:2.0.6: Failed to read artifact descriptor for org.apache.maven:maven-plugin-api:jar:2.0.6: Could not transfer artifact org.apache.maven:maven-plugin-api:pom:2.0.6 from/to central (https://repo.maven.apache.org/maven2): Connection reset -> [Help 1]
For a better look, an image of the error is also attached below...
Please help me to figure out the real cause for this issue and a way to overcome and continue. Thank you!
CodePudding user response:
Along with my team we were investigating the root cause for this issue and we were unable to find a solution. However most frequent reason was that the GitLab-Runner running in a different server has connection issues such that this happens.
One of my team members found a solution and that worked for us. Our issue solved and now the GitLab pipeline builds and runs successfully. That worked for us and hope anyone will the similar issue would also find this helpful.
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repositories>
Adding the above mentioned code block to POM file solved the issue. Maybe this will help anyone who faces the same situation.