So, I have a bit of a problem and being a bit new to Maven am not sure how to procede.
I have a Maven Project with a bunch of dependencies. Most of them are the typical stuff like Jackson, Mongo, Junit, etc. However, I also have dependencies on some local requirements that I have.
In eclipse I went File->Import->Install Or Deploay an Artifact to a Maven Repo
I point to the proper artifact and it's coresponding pom file and all is well. the pom.xml file doesn't throw any errors and all is good. However, if I go to the overview or look at the code in general it's not picking up these libraries.
I went and verified in my .m2\repository folder and all the libraries are there. I used 7zip and the code is in the jars as I'd except.
So, I thought - I'll try to do a Maven Update and have it be done in Offline mode to tell it to look at the local repos. Well, if I do that - the following error occurs:
UnresolvableModelException: Cannot access central (http://repo.maven.apache.org/maven2) in offline mode and the artifact has not been downloaded from it before.
If I then go back and try to do a regular update I get the following
ArtifactDescriptorException: Failed to read artifact descriptor for XXXX:YYYY which is my local repository stuff.
Seems I lose either one or the other.
Any help would be great!
Try to run Maven in debug mode with -X option :
mvn install -X
You should see more information :
[DEBUG] Reading global settings from D:\tools\apache-maven-3.2.1\conf\settings.xml
[DEBUG] Reading user settings from C:\Users\jrrevy\.m2\settings.xml
[DEBUG] Using local repository at D:\tools\apache-maven-3.0.5\.m2\repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for D:\tools\apache-maven-3.0.5\.m2\repository
$M2_HOME or localrepository could be wrong due to settings.xml not configured or overriden by another one. This often happen, even to me.
Related
I am following the Apache Geode build instructions to build the project. My environment is Windows 10.
What I am actually interested is to get Geode Pulse WAR artifact from the build. However, the build is not successful because of errors like this,
> Could not resolve all files for configuration ':geode-core:integrationTestCompileClasspath'.
> Could not find log4j-core-tests.jar (org.apache.logging.log4j:log4j-core:2.11.1).
Searched in the following locations:
file:/C:/Users/james/.m2/repository/org/apache/logging/log4j/log4j-core/2.11.1/log4j-core-2.11.1-tests.jar
> Could not find log4j-core-test-sources.jar (org.apache.logging.log4j:log4j-core:2.11.1).
Searched in the following locations:
file:/C:/Users/james/.m2/repository/org/apache/logging/log4j/log4j-core/2.11.1/log4j-core-2.11.1-test-sources.jar
How do I skip all the tests including integration tests or continue to build with tests failure? I have tried gradlew build -x test but it broke with the same build error. Please advise. Thanks
I've had this issue in the past and I believe it's related to your local MAVEN repository, not to Geode. Can you try to entirely remove the folder C:/Users/james/.m2/repository/org/apache/logging/log4j/log4j-core/2.11.1 and try again?, MAVEN will surely download the jar from scratch and everything should work fine.
Cheers.
I've downloaded SBT 0.3.15 and I'm trying to run it : for now, I just want to run SBT and get the prompt ; I am not at the stage where I want to build a project yet (even though I expect to be able to do it very soon).
However, I face issues with strange dependencies that SBT tries to download. I initially faced issue with the proxy, but it's better now. The first thing that SBT tries to download is pom.xml for jansi-project 1.11 and it works :
downloading https://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.11/jansi-1.11.pom ...
Maven Central: downloading https://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.11/jansi-1.11.pom
to C:\Users\vfuchs070114\.ivy2\cache\org.fusesource.jansi\jansi\ivy-1.11.xml.original.part
sha1 file found for https://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.11/jansi-1.11.pom: checking...
Maven Central: downloading https://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.11/jansi-1.11.pom.sha1
to C:\Users\VFUCHS~1\AppData\Local\Temp\ivytmp1821470066062959950sha1
sha1 OK for https://repo1.maven.org/maven2/org/fusesource/jansi/jansi/1.11/jansi-1.11.pom
[SUCCESSFUL ] org.fusesource.jansi#jansi;1.11!jansi.pom(pom.original) (1085ms)
The next file it tries to download is fusesource-pom-1.8.jar from Maven central repo :
HTTP response status: 404 url=https://repo1.maven.org/maven2/org/fusesource/fusesource-pom/1.8/fusesource-pom-1.8.jar
CLIENT ERROR: Not Found url=https://repo1.maven.org/maven2/org/fusesource/fusesource-pom/1.8/fusesource-pom-1.8.jar
And here are a couple more :
https://repo.typesafe.com/typesafe/ivy-releases/org.fusesource/fusesource-pom/1.8/jars/fusesource-pom.jar
https://repo.typesafe.com/typesafe/ivy-releases/org.fusesource/fusesource-pom/1.8/ivys/ivy.xml
https://repo.scala-sbt.org/scalasbt/ivy-snapshots/org.fusesource/fusesource-pom/1.8/ivys/ivy.xml
https://repo.typesafe.com/typesafe/ivy-releases/org.fusesource.jansi/jansi-project/1.11/ivys/ivy.xml
https://repo.scala-sbt.org/scalasbt/ivy-snapshots/org.fusesource.jansi/jansi-project/1.11/ivys/ivy.xml
https://repo.typesafe.com/typesafe/ivy-releases/org.fusesource.jansi/jansi/1.11/ivys/ivy.xml
https://repo.scala-sbt.org/scalasbt/ivy-snapshots/org.fusesource.jansi/jansi/1.11/ivys/ivy.xml
Then it fails... Since even through my browser I don't see anything available on these URLs, I'm ruling out a proxy config issue.
how am I supposed to get these dependencies, and from where ?
Thanks
After days of struggle, I don't have the exact answer to my question, but I've been able to find a workaround.
downloading dependencies through the corporate proxy just doesn't work and I don't know why. I configure SBT with same properties that I configure git : I'm able to clone GitHub projects, but SBT isn't able to get the dependencies. There's not enough specific infos in SBT logs to investigate anything, so I gave up this option.
we have Nexus as internal artifactory and proxy for external repositories. I asked the team in charge of it to create a new repository on our Nexus, mirroring https://dl.bintray.com/typesafe/ivy-releases/ , and then added the internal repositories URL in my config, as suggested here : http://www.scala-sbt.org/0.13/docs/Proxy-Repositories.html
maven-internal-thirdparty-proxy: internal_proxy_url, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
ivy-internal-typesafe-proxy: internal_proxy_url, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
I had to remove the internet proxy config I had put initially, to make sure SBT doesn't try to go through internet proxy to reach the internal proxy repos.
I just checked out maven based java project from svn to local box in eclipse where maven 3.0.2 is available. However while reviewing class path configuration many of dependencies are broken such as org.restlet-2.0.15.jar. Strange part is C:/Users/daeyoung/.m2/repository has that broken jar file but .lastUpdated is appended. After reading many posts from WWW, the way I understood to fix the problem is delete *.lastUpdated file then re-download it from central repo.
But when I reviewed pom.xml file there is no mention of repository (strange...) and as soon as I delete *.lastUpdated file, it comes back (e.g. org.restlet-2.0.15.jar.lastUpdated).
I am new to Maven.
I'd appreciate if someone can guide me to a right direction to fix this problem.
[update]
I created following user settings.xml file under /Users/daeyoung/.m2/ directory. I thought at least that would take care of downloading org.restlet package.
However when I ran mvn command (literally mvn) inside of project folder, system was saying..
I don't want to modify pom.xml file but rather via user settings.xml I thought I could connect to maven restlet repo and download specified target package but I am not sure what I am missing in here. I think contents of settings.xml is not correct.
I just want to say thanks to all who have given me advice. First I was not well equipped to understand the advice but more I looked at the problem/read about maven articles. It was clear what needs to be done to fix the problem.
Bottom line is I manually downloaded dependencies to ${user_name}/.m2/repository for missing jars. I configured ${MAVEN_HOME}/conf/settings.xml to point to local repository then I ran mvn validate/clean/package sequentially from eclipse via m2e plugin (or I could have done same thing from command line).
I see that a feature I want to build from HEAD (to get the benefit of bug fixes) is in git.eclipse.org. It used to be a bit tricky to build some Eclipse features from source, but now there is Tycho which is supposed to make it easier, because it uses Maven. Fortunately, I see that this feature has already been set up to use Tycho and Maven.
But how to use Tycho as an end-user is not exactly obvious - and I have tried running a Maven build with "clean install" as the Goal, but that failed.
Please give complete step by step instructions for how to run a Tycho build, starting with the source code checkout of the project to build, including installing any necessary software, and finishing with running Eclipse with the desired feature.
Also, what about if I want to make changes to the source code of the plugin(s) within Eclipse - does that mean I should use a different way of building it?
FYI, this is my concrete problem that lead to the general question above: I tried to build the feature org.eclipse.linuxtools/systemtap/org.eclipse.linuxtools.systemtap-feature, and I have the systemtap plugins checked out in sibling directories (because they are part of the same git repository, so I get them for free).
The error is:
[ERROR] Failed to execute goal org.eclipse.tycho.extras:tycho-source-feature-
plugin:0.14.0:source-feature (source-feature) on project org.eclipse.linuxtools.systemtap: Could not generate source feature for project MavenProject: org.eclipse.linuxtools.systemtap:org.eclipse.linuxtools.systemtap:1.2.0-SNAPSHOT # /home/greenrd/git/org.eclipse.linuxtools/systemtap/org.eclipse.linuxtools.systemtap-feature/pom.xml
[ERROR] Missing sources for plugins [org.eclipse.linuxtools.systemtap.ui.consolelog_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.editor_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.graphingapi.ui_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.logging_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.structures_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.graphing_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.systemtapgui_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.ide_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.dashboard_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.dashboardextension_0.3.0.201203201951, org.eclipse.linuxtools.systemtap.ui.graphicalrun_0.3.0.201203201951]
[ERROR] -> [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/MojoExecutionException
Projects using Tycho are supposed to build like any other Maven project, i.e. you should be able build the project and run its tests by calling mvn clean verify in the root of the project. (If there is no pom.xml in the root, look for a project called something with "parent" or ask the project for their build entry point.)
Just like in Maven, you typically won't be able to check out a project and directly build only parts of it, e.g. by calling mvn an eclipse-feature sub-project. For this to work, you first need to build the whole project once with mvn clean install and then you'll be able to also re-build parts of the project.
In case you do source modifications, I'd recommend to do a full build again. It is possible to build only the changed sub-projects, but you'd also need to ensure manually that all aggregating project types (i.e. "eclipse-feature" and "eclipse-repository") are rebuilt, which is probably not worth the effort. (Unfortunately, the Maven option --also-make-dependents is currently not supported by Tycho.)
In order to install from your local build result, you'll need to find the sub-projct that assembles the project's binaries as a p2 repository: Look for target/repository (or possibly target/site) directories and check the features/plugins sub-folders. The repository or site folder can be used as "Local" source for the update mechanism in Eclipse.
Disclaimer: The steps described above will not work for all projects using Tycho. In case of problems, you should check the project's documentation for special instructions for running their build, or ask the project's developers.
mvn package usually results in packaged plugins and features using a Tycho build. Perhaps your failure is related to using mvn install which also involves running integration tests in the verify phase.
If mvn package does not work, please add the project you're building and the error you're getting.
I have moved to Maven recently, and since it works fine for resources up to date in some repositories, it's not obvious for non-maven ones.
I have something very simple to achieve (in the idea), but that I am unable to express so far:
I need to compile my code with a jar that can be found here:
https://hudson.eclipse.org/hudson/view/WTP/job/cbi-wtp-wst.xsl.psychopath/ws/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/target/
What do I have to put in my pom.xml to make Maven downloading the .jar + the java source + the javadoc, and eventually the other dependencies (actually IBM ICU, Xerces, JavaCup) that are mentionned in the supplied MANIFEST ?
I have read lots of documents, including those with a plugin called Tycho, but nothing helpfull for that simple task.
Thanks for your help.
Maven only works well if all artifacts needed for a build are contained in the local or a configured remote repository. So you have to do the following jobs:
Find out if eclipse plugins are deployed in a Maven2-style repository, and what the URL of that repository is.
Then find out which version of that plugin (artifact) you need.
Maven allows you to configure what will be copied locally: jar file, sources and api doc if you want to.
Maven should then be responsible to download as well all needed artifacts for the plugin you want to use.
After looking at the contents of the URL you gave us (especially the file p2content.xml), it looks like there should be a repository. I searched for the maven repository for org.eclipse.wst.xml.xpath2 and found the URL http://maven.eclipse.org/nexus/content/repositories/testing/org/eclipse/wst/org.eclipse.wst.xml.xpath2/1.1.0/org.eclipse.wst.xml.xpath2-1.1.0.pom
So the repository you are searching for is located at http://maven.eclipse.org/nexus. Just open it, search for example for xpath2, and Nexus, the repository software used there will you show the available artifacts. Depending on what was deployed to that repository, it may contain only the library, or have even sources and JavaDoc bundled with it. For the example above (xpath2), there seems to be only the POM itself and the library (the jar). If you take as example junit, you will find all versions and variants, even with sources.jar and javadoc.jar.
After you have found the needed artifact, you can include it in the dependency section of your POM. And you have to add http://maven.eclipse.org/nexus as a remote repository in the configuration of your Maven installation.
The question and its answer Get source JARs from Maven repository explain how to fetch sources and JavaDoc (if they are available).
You need a maven repository which contains this artifacts (i don't know, if Eclipse hosts a repository for their projects). You can also deploy manually the artifacts to a local repository on your computer.