Jenkins Offline cannot able to resolve Maven Dependencies - maven

I am trying to Build a Maven Project from Jenkins.
My server is Offline, so no Internet access or no proxy settings.
Maven Project Build absolutely perfect from Jenkins if Internet is present.
But same project fails to Build from Jenkins in absence of Internet. My repo is containing this plugin.
My Maven Home:/home/oracle/app/Trust/maven
My Jenkin Home:/home/oracle/.jenkins/
.m2 file Location:/home/oracle/.m2
Error: [ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1: The repository system is offline but the artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 is not available in the local repository. -> [Help 1]

Related

Git runner - problem to download dependency

I have one project that uses the git runner.
The command mvn package works fine on local, all dependencies are downloaded from my local nexus.
When I execute build command at the git runner environment, all dependencies from my local nexus where downloaded without problem too, but only one dependency is a problem, lets see:
[ERROR] Failed to execute goal on project sic: Could not resolve dependencies for project com.example:sic:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at br.com.sspds:ojdbc6:jar:1.0.1: Failed to read artifact descriptor for br.com.sspds:ojdbc6:jar:1.0.1: Could not transfer artifact br.com.sspds:ojdbc6:pom:1.0.1 from/to Nexus (http://172.25.100.75:8090/repository/maven-public/): Transfer failed for http://172.25.100.75:8090/repository/maven-public/br/com/sspds/ojdbc6/1.0.1/ojdbc6-1.0.1.pom: No route to host (Host unreachable)
One big detail: the library ojdbc6-1.0.1.jar was developed by our team and made available manually on our nexus server.
My configuration from nexus server is into my pom.xml.
Any idea about this problem?

Spring MVC issues in STS 3.7.3

I am getting this error on importing https://github.com/spring-projects/spring-mvc-showcase in STS 3.7.3:---
Description Resource Path Location Type
Failure to transfer org.codehaus.mojo:aspectj-maven-plugin:pom:1.2 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.codehaus.mojo:aspectj-maven-plugin:pom:1.2 from/to central: connect timed out pom.xml /spring-mvc-showcase line 1 Maven pom Loading Problem
Edit
Mvn is ok now but pom.xml error still persists if I remove the errors and do maven clean I get errors as:
[INFO] https://repo.maven.apache.org/maven2/org/codehaus/mojo/aspectj-maven-plugin/1.2/aspectj-maven-plugin-1.2.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [ERROR] Plugin org.codehaus.mojo:aspectj-maven-plugin:1.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:aspectj-maven-plugin:jar:1.2: Could not transfer artifact org.codehaus.mojo:aspectj-maven-plugin:pom:1.2 from/to central: connect timed out -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
First of all STS is build on Eclipse. So you can easily install the IDE Integration Eclipse IDE - M2Eclipse for STS. You can see how here. If you want to use it with this integration plugin you dont need to have a local maven repository.
Resolving Maven dependencies from the Eclipse workspace without installing to local Maven repository
But its also possible to use maven as a local system repository. Download is here and follow the steps for the installation and configuration here.
To see if you have a valid maven installation done, you can test it by typing mvn -v in a cmd shell or using STS -> right click on your project -> run as -> maven build or maven install.
Update:
I would say delete the project from your workspace and try it again. Download the project from gitHub as a zip file and import it again to your workspace. Right Click -> import -> existing maven project.
If you need to use a proxy for your connection you have to create a settings.xml in your .m2 folder. Look here for more info

mvn cannot download a jar issue

when I build a project in linux environment, it says:
[ERROR] Plugin org.apache.maven.plugins:maven-enforcer-plugin:1.0-beta-1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-enforcer-plugin:jar:1.0-beta-1: Could not transfer artifact org.apache.maven.plugins:maven-enforcer-plugin:pom:1.0-beta-1 from/to Main Maven Repo (http://repo1.maven.org/maven2/): repo1.maven.org: Unknown host repo1.maven.org -> [Help 1]
I'm using my company internal mirror repository.
Any one help me?
Update:
I copied the .m2 folder to the linux home/user_name , resolved this issue
If you want to use only your company's repo and not the public ones, such as maven central, take a look here Disable Maven central repository.
Otherwise you need your station/network configured to allow access to the public repos and resolve their IPs from the hostnames.

Building Oozie failes

I am using maven 3.2.1,java 1.7 and Oozie4.0.0. when I tried to build it I got maven plugin and dependency error.[ERROR] Failed to execute goal on project oozie-client: Could not resolve dependencies for project org.apache.oozie:oozie-client:jar:4.0.0: Failed to collect dependencies at junit:junit:jar:4.10: Failed to read artifact descriptor for junit:junit:jar:4.10: Could not transfer artifact junit:junit:pom:4.10 from/to central (http://repo1.maven.org/maven2): repo1.maven.org: Name or service not known: Unknown host repo1.maven.org: Name or service not known -> [Help 1]
Well, it seems you can't access to repo1.maven.org. Try a another maven repo and check your internet connection ;)

Configuring Maven, jenkins with Sonar

I have installed Jenkins and Sonar, both work fine. I am able to build a maven android project using Jenkins. No i want to run Sonar on the android project. I have installed the Sonar plugin in Jenkins. Configured the sonar module in the configure system module and added a post build task for sonar to run
[ERROR] Plugin org.codehaus.mojo:sonar-maven-plugin:sonar or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:sonar-maven-plugin:jar:sonar: Could not find artifact org.codehaus.mojo:sonar-maven-plugin:pom:sonar in nbs-repo (http://10.10.2.89:8081/nexus/content/groups/public/) -> [Help 1]
org.apache.maven.plugin.PluginResolutionException: Plugin org.codehaus.mojo:sonar-maven-plugin:sonar or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:sonar-maven-plugin:jar:sonar
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:129)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:142)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:261)
at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:185)
at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.getMojoDescriptor(MojoDescriptorCreator.java:235)
at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:106)
at
My nexus installation works fine ? What am i doing wrong. My maven pom.xml does not contain any sonar plugin. What am i doing wrong?
Kind Regards
From the error message its clear that mvn is trying to download the sonar-maven-plugin from your local Nexus repository which does not seem to have it.
Try mvn -U in the build in case you already have the plugin.This overrides the negative cache. Another thing is <updatepolicy> in your settings.xml
If you don't have the plugin and neither does your Nexus connect to the internet, you have to manually download and upload in Nexus of course. Please remember to match the version of the plugin with the SONAR installation. Also there would be a few (7-10) transitive dependencies with the plugin which you will need. I suggest using mvn -X or mvn -e to see a verbose output during your testing.

Resources