Im trying to run maven on a linux server that does not have internet connectivity.
I installed maven but when I run "mvn compile" on my java project, it gets stuck trying to download plugins.
How do I get past it? Is there a place to get a full install with all plugins required so it dosent have to download anything?
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.apache.maven.plugins:maven-resources-plugin:jar:2.6 has not been downloaded from it before. -> [Help 1]
You can download all jars or import/move them already downloaded from another machine from userHome/.m2 to your ~/.m2 folder, and when you'll try to compile again it'll pull the libs/plugins from m2 folder without trying to download them.
No.
Running Maven does not make sense unless you are connected to a Maven repository.
If you have no internet connection then you need an internal Maven repository, i.e. a Nexus or Artifactory server in your company. Now this server does not only provide the dependencies for you, but also the plugins for Maven to run (of course, it has to get them somewhere from, so it needs some kind of connection to the internet).
Related
I am trying to run a Spring Project, with several dependencies, that I have already downloaded into my local repository, and have also done followings :
Added local repository path in setting.xml in localRepository tag.
Running the project using mvn install -nsu -llr -o , for offline mode.
And I am getting following error :
[ERROR] Failed to execute goal on project file2Json: Could not resolve
dependencies for project
com.nse.file2Json:file2Json:jar:0.0.1-SNAPSHOT: Cannot access central
(http://repo1.maven.org/maven2) in offline mode and the artifact
com.fasterxml.jackson.dataformat:jackson-dataformat-csv:jar:2.8.4 has
not been downloaded from it before. -> [Help 1]
I have the dependency installed, take a look :(
I have following questions :
Why is the project is trying to look into http://repo1.maven.org/maven2 when I am using offline mode ?
How can I run the project offline, by providing the required dependencies at required paths ?
Please help !
thanks in advance.
It says it cannot access Maven Central because you are in offline mode. And it tries to look there, because ´jackson-dataformat-csv` is not in your local repository, so Maven needs to get it from somewhere (and Maven Central is the default repository).
What you need to do is to execute mvn dependency:go-offline before you switch to the offline mode. This will download everything that you need (dependencies, transitive dependencies as well as plugins).
I have cloned the git repository from https://github.com/viatra/org.eclipse.viatra.examples
and imported the project incquery-demo-generic (located in /query/headless-maven) as a Maven Project in Eclipse. Unfortunately I get the following error when I open the project's pom.xml:
Furthermore everytime when I click on "Run As" -> "Maven install" or "Maven build..." I get the following error message in the console:
Failed to execute goal on project incquery-demo-generic: Could not resolve dependencies for project hu.bme.mit.incquery:incquery-demo-generic:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at org.eclipse.incquery:runtime:jar:0.8.0-SNAPSHOT: Failed to read artifact descriptor for org.eclipse.incquery:runtime:jar:0.8.0-SNAPSHOT: Failure to find org.eclipse.incquery:org.eclipse.incquery.parent:pom:0.8.0-SNAPSHOT in https://repo.eclipse.org/content/repositories/emf-incquery-snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of incquery-snapshot has elapsed or updates are forced -> [Help 1]
Blockquote
In the Maven Dependencies Folder I can find some, but not all necessary jar files.
I have tried "Project clean", "Maven update", "Maven build... (Goal: clean package)" and to delete the .m2 repository and to re-build the maven project, but nothing helps.
I also tried to download some dependencies as .jar files and add them to the build-path, but they contain nothing but pom.xml and properties-files themself, thus I keep getting "cannot be resolved to a type" errors in relevant parts of the Java src-code.
Can somebody successfully run this project in her/his eclipse?
I am not an expert on Maven Projects so please tell me what to do in "layman words".
Thanks & kind regards,
MCRaven
The projects in the VIATRA examples repository (I notice it as one of the committers of the VIATRA project) are somewhat unusual: they are Eclipse plug-in projects that have Maven build informations added via Maven Tycho.
One more thing here: the 0.8.0 version of EMF-IncQuery bundles was released in 2014, thus it makes sense that the corresponding snapshot versions are removed. This means to me that this example was not updated for a long time. This is somewhat by design - some examples are not updated for each released version, but they are not are still available for references. If you are explicitly interested in this example, please contact us on VIATRA project forums or Bugzilla and we will provide example-specific support there.
Inside Eclipse we usually not rely on Maven (and our experience is that Tycho-based projects often does not work with M2E correctly). You could try to update Maven dependencies for the org.eclipse.incquery projects to 0.8.0, but I am still unsure whether it will work or not.
On the other hand, I'd rather suggest to install the old EMF-IncQuery version into your Eclipse instance and then simply rely on the Java Development Tools and the Plugin Development Environment to compile the project, and simply ignore any errors in the Maven descriptors for now.
On my windows machine: I have setup jenkins CI to automatically create build.
But every time build is failing because of the third party ojdbc7.jar file.
[ERROR] Failed to execute goal on project abc-cc-onboarding-repository: Could not resolve dependencies for project com.abc.cc:abc-cc-onboarding-repository:jar:1.0-SNAPSHOT: Could not find artifact com.oracle:ojdbc7:jar:12.1.0.1.0 in central (https://repo.maven.apache.org/maven2) -> [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]
When I manually build using: mvn -U clean build, everything works fine.
because I have manually installed ojdbc7.jar in the local repository (.m2)
Something is wrong with the Jenkins integration with maven.
Can anybody suggest on this?
Something is wrong with the Jenkins integration with maven.
No. That's not the problem. Jenkins integration with Maven works just fine.
The problem is that ojdbc7.jar is not in the Maven Central repo ... which is the default place that Maven looks. (Or at least, it is not in Maven Central not with those artifact "coordinates". There are some ojdbc artifacts with different coordinates. YMMV.)
The real problem is that Oracle don't want you to download Oracle JARs from Maven Central. Oracle want you to download from their Maven repo instead.
One solution is to do what you have been doing. Simply add the artifact to your local repo (or Jenkins' local repo for the project). But you are not happy with that.
The other solution is to configure the remote repos that Maven uses.
Here is a page that explains how to configure (stand alone) Maven to include the Oracle repo:
Get Oracle JDBC drivers from the Oracle Maven Repository - NetBeans, Eclipse & Intellij
For the Jenkins case, you need to configure the settings that the Jenkins server uses:
How to manage maven settings.xml on a shared jenkins server?
This lists various ways of doing this.
SOLUTION THAT WORKED FOR ME:
What i found after the analysis and it resolved my problem, hope it will help somebody like me.
Actually jenkins creates a separate repository for separate projects.
like if i have 10 project in my jenkins workspace then it creates 10 repository one for each project (inside the project on top level we can see that).
so now i installed manually ojdbc7.jar inside my jenkins project repo and it solved my problem.
The above error occurs mostly when Jenkins is unable to download the oracle jar.
To sort the above issue
Create the settings.xml and settings-security.xml files in Jenkins through the "Managed files" in the administration home. To do that follow this link - https://wiki.jenkins.io/display/JENKINS/Config+File+Provider+Plugin#ConfigFileProviderPlugin-Howitworks
NB: Ensure to put in your Oracle credentials in these two files. To do that follow this link - https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9017
In your jenkins project under configurations in Build Environments include this files under the option Provide Configuration files. As shown below:
Once done build it and it should work.
I've just started helping my professor out for his research project and I'm trying to get it set up on my local windows computer. I'm stuck with this error:
Failed to execute goal on project tornado: Could not resolve
dependencies for project tornado:tornado:jar:0.0.1-SNAPSHOT: Failure
to find com.disco:disco:jar:10.2.0 in http://clojars.org/repo was
cached in the local repository, resolution will not be reattempted
until the update interval of clojars.org has elapsed or updates are
forced
Notes:
It's a maven project being run on eclipse.
I've tried multiple ways of adding the disco-2.0.jar file to the build path but I'm not sure if that's what I'm meant to be doing or if it's even the right file, although I haven't found any other disco file within the project directories.
I've tried mvn clean install -U to see if it may just have been a problem with resetting the maven project.
Well the log reads is clear and you could verify it as well:
Failure to find com.disco:disco:jar:10.2.0 in http://clojars.org/repo
If you navigate to the https://clojars.org/repo/com/ there is no disco.jar available there. Hence the failure.
Probably this could be some local jar that might need to be build either locally or required by its owner to be pushed(mvn deploy) to clojars in another case.
Also mvn clean install -U help you fetch the latest of SNAPSHOT, in your case this would fetch the latest tornado:tornado:jar:0.0.1-SNAPSHOT but that fails further sicne it specifies the com.disco:disco:jar:10.2.0 as dependency which is not found anywhere for your build to proceed.
You need to make the disco-2.0.jar available from a Maven repository. If you have a Nexus or Artifactory, upload it there. Alternatively, you can install it into the local repository of your computer using the install:install-file goal.
Furthermore, it is possible to define local directories as additional Maven repositories, see https://stackoverflow.com/a/28762617/927493.
I am trying to install a project on Ubuntu server but I am receiving the following error:
[ERROR] Failed to execute goal on project db: Could not resolve dependencies for project com.company.soft.prod:db:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: commons-codec:commons-codec:jar:1.5, mysql:mysql-connector-java:jar:5.1.26, org.springframework:spring-jdbc:jar:3.2.4.RELEASE, org.springframework:spring-beans:jar:3.2.4.RELEASE, org.springframework:spring-core:jar:3.2.4.RELEASE, org.springframework:spring-tx:jar:3.2.4.RELEASE, org.springframework:spring-orm:jar:3.2.4.RELEASE, aopalliance:aopalliance:jar:1.0, org.hibernate:hibernate-core:jar:3.5.1-Final, antlr:antlr:jar:2.7.6, commons-collections:commons-collections:jar:3.1, dom4j:dom4j:jar:1.6.1, xml-apis:xml-apis:jar:1.0.b2, javax.transaction:jta:jar:1.1, org.hibernate:hibernate-entitymanager:jar:3.5.1-Final, org.hibernate:hibernate-annotations:jar:3.5.1-Final, org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final, cglib:cglib:jar:2.2, asm:asm:jar:3.1, javassist:javassist:jar:3.9.0.GA, org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final, org.springframework:spring-context:jar:3.2.4.RELEASE, org.springframework:spring-aop:jar:3.2.4.RELEASE, org.springframework:spring-expression:jar:3.2.4.RELEASE, com.existanze.libraries:orm:jar:0.0.3, joda-time:joda-time:jar:1.6.2, com.jolbox:bonecp:jar:0.7.1.RELEASE, com.google.guava:guava:jar:r08: The repository system is offline but the artifact commons-codec:commons-codec:jar:1.5 is not available in the local repository.
I have to say that locally I am not facing any problem with dependencies resolution. What I am developing is a mavenized Spring MVC multi-project in Netbeans.
Now that I am trying to deploy it to the server I receive this error. I tried also mvn clean install -U to update SNAPSHOT but it still does not work. I don't know what else to do, so at this point I need some expert help.
Thank you very much.
I suspect that your Ubuntu server does not allow external internet connection to the central repository. Please change the firewall to allow the central repository access. If this is not allowed due to your corporation security policy, you might have to deploy a enterprise maven repository within your corporation.