getting Tycho to resolve dependencies from old-style Eclipse update site - maven

I'm trying to build a plugin that depends on org.apache.uima.runtime, which is part of the UIMA Eclipse plugins hosted on the UIMA Eclipse update site. This update site is an old-style (pre-p2) update site, so I know that Tycho won't resolve those dependencies. So I'm trying to make a local copy of the UIMA Eclipse update site, upgrade it to p2, and then get the dependencies from there. Here's what I tried:
$ svn co http://svn.apache.org/repos/asf/uima/uimaj/trunk/uimaj-eclipse-update-site/
...
Checked out revision 1395335.
$ java -jar /.../eclipse/plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar \
-application org.eclipse.equinox.p2.publisher.UpdateSitePublisher \
-metadataRepository file:/.../uimaj-eclipse-update-site \
-artifactRepository file:/.../uimaj-eclipse-update-site \
-source /.../uimaj-eclipse-update-site
Generating metadata for ..
Generation completed with success [0 seconds].
If I look at the uimaj-eclipse-update-site directory, I now see an artifacts.xml and a content.xml, so that seems right. I also checked it with the p2 repository browser, and nothing shows up as "PARTIAL", and I can see an org.apache.uima.runtime.feature.jar 2.4.0 and an org.apache.uima.runtime.feature.group 2.4.0.
I now add this local site to the pom.xml of my Eclipse plugin:
<repository>
<id>uima</id>
<layout>p2</layout>
<url>file:/.../uimaj-eclipse-update-site</url>
</repository>
When I run mvn compile in my updated project, Tycho finds the local update site, but still can't find org.apache.uima.runtime:
...
[INFO] Adding repository file:/.../uimaj-eclipse-update-site
[INFO] Adding repository file:/.../uimaj-eclipse-update-site
[INFO] Resolving dependencies of MavenProject: org.cleartk:org.cleartk.plugin.jcasgen.m2e:0.9.1.qualifier # /.../jcasgen-m2e-connector/org.cleartk.plugin.jcasgen.m2e/pom.xml
[INFO] Cannot complete the request. Generating details.
[INFO] Cannot complete the request. Generating details.
[INFO] {osgi.ws=cocoa, osgi.os=macosx, osgi.arch=x86_64, org.eclipse.update.install.features=true}
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: org.cleartk.plugin.jcasgen.m2e 0.9.1.qualifier
[ERROR] Missing requirement: org.cleartk.plugin.jcasgen.m2e 0.9.1.qualifier requires 'bundle org.apache.uima.runtime [2.4.0,3.0.0)' but it could not be found
[ERROR]
[ERROR] Internal error: java.lang.RuntimeException: "No solution found because the problem is unsatisfiable."
...
What am I doing wrong?
If you want to replicate the error, I'm running mvn compile from this directory (after modifying the pom.xml as above):
http://cleartk.googlecode.com/git/jcasgen-m2e-connector/
EDIT: I do see org.apache.uima.runtime in the generated artifacts.xml:
<artifact classifier='org.eclipse.update.feature' id='org.apache.uima.runtime' version='2.4.0'>
<properties size='4'>
<property name='artifact.size' value='9466'/>
<property name='download.size' value='9466'/>
<property name='download.md5' value='f9d4f1f8dc54f0a99379dcede2fc2700'/>
<property name='download.contentType' value='application/zip'/>
</properties>
</artifact>

Browsing the svn repo link, it looks like the plugins directory is empty and there are only features present. You may just need to run maven first to "build" it and populate the plug-ins directory.
If you have all of the content you could run the p2 features and bundles publisher application to generate a p2 repository directly. If it is to be consumed in a Tycho build the category side of the update site does not need to be generated.

I got late to the party but Apache UIMA now has a p2 repository.
In your pom.xml add the uima repository:
<repositories>
<repository>
<id>uima</id>
<url>http://www.apache.org/dist/uima/eclipse-update-site</url>
<layout>p2</layout>
</repository>
</repositories>

Related

Maven can't find dependencies [dependencyResolutionException]

I added a Maven dependency to my project and my project compiles locally, while it doesn't compile on server. It can not resolve the newly added dependency.
This is my pom.xml file:
<repositories>
<repository>
<id>rep</id>
<name>Repository</name>
<url>http://artifacts.com/rep</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.project.rest</groupId>
<artifactId>common</artifactId>
<version>2.0.5</version>
</dependency>
</dependencies>
And this my console output with an error:
Downloading: http://artifacts.com/rep/com/project/rest/common/2.0.5/common-2.0.5.pom
[WARNING] The POM for com.project.rest:common:jar:2.0.5 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.154s
[INFO] Finished at: Tue Feb 03 06:58:35 BRT 2015
[INFO] Final Memory: 9M/152M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project server: Could not resolve dependencies for project org.server:
server:jar:2.5.1-SNAPSHOT: The following artifacts could not be resolved: com.project.rest:common:jar:2.0.5:
Could not find artifact com.project.rest:common:jar:2.0.5 in rep (http://artifacts.com/rep) -> [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/DependencyResolutionException
(I hid all real URLs and package.)
What could be the problem?
The first line "Downloading:..." only says that maven tries to download the artifact. It is no statement about success. If maven is successful you will get another line starting with "Downloaded: ..."
So in your case maven was not able to download the file. Check the logged url in your browser if it does exist and if it is protected.
BTW <updatePolicy>always</updatePolicy> is quite uncommon for release repos, because releases should not change any more.
Make sure your repository is configured properly. Try to search, in your repo, for
com.project.rest:common of version 2.0.5.
Is this your own project? some jar that you have built? are you sure you deployed it to your repo? if it is not in your repo, try to search for it in your local repo (usually .m2/repository/com/project...)
DependencyResolutionException
(source: Maven Confluence)
This error generally occurs when Maven could not download dependencies. Possible causes for this error are:
The POM misses the declaration of the <repository> which hosts the artifact.
The repository you have configured requires authentication and Maven failed to provide the correct credentials to the server. In this case, make sure your ${user.home}/.m2/settings.xml contains a <server> declaration whose <id> matches the <id> of the remote repository to use. See the Maven Settings Reference for more details.
The remote repository in question uses SSL and the JVM running Maven does not trust the certificate of the server.
There is a general network problem that prevents Maven from accessing any remote repository, e.g. a missing proxy configuration.
You have configured Maven to perform strict checksum validation and the files to download got corrupted.
Maven failed to save the files to your local repository, see LocalRepositoryNotAccessibleException for more details.
In Maven 3 if you just had a failed download and have fixed it (e.g. by uploading the jar to a repository) it will cache the failure. To force a refresh add -U to the command line.
In case of a general network-related problem, you could also consult the following articles:
Configuring a Proxy
Security and Deployment Settings
Guide to Remote Repository Access through Authenticated HTTPS
The project you mentioned doesn't contains POM i.e. it is not a MAVEN project. The .m2(look this at c drive or where you have installed) repository contains all the dependencies folders look there whether it contains the required project or not i.e. com.project.rest.
Like suggested by console output, you can check the Maven Wiki page (http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException) for more information on where the problem might lay.
Given the information you provided. I would guess we are looking at the point one issue:
The POM misses the declaration of the which hosts the artifact.
Maven repositories are of three types: local, central and remote.
In your case, your local repository contains the project specific artifacts, but the central repository doesn't.
Local repository is on your local machine. When you run a Maven build, Maven automatically downloads all the dependency jars into the local repository.
Central repository is web repository provided by a community and it contains a number of commonly used libraries, found here https://repo1.maven.org/maven2/.
Remote repository is developer's own custom repository containing required libraries or other project jars. Developer defines these repositories in POM file using tags.
I would suggest the following:
check your repository tag, if the repository is correct
check if the repository contains the artifacts specified in your dependency tag
If you are using IntelliJ IDE (Jetbrains) and code is correct then
Check the TOGGLE OFFLINE MODE button. If we enable offline mode, then IDE do not let maven download a dependency and it cannot found the library that causes error.
So make sure your project is build in ONLINE mode.

Where to add dependencies in MAVEN multi-module project

I am trying to make sense of all the dependency thing in maven multiple module projects. As a starting point I used appfuse to create a new spring mvc multi-module project. It initially has web and core modules.
I found the knowledge of deploying this project. But when I get an error. I am confused of where to add a dependency or a plugin always. I would like to clarify with the following issue.
I created a appfuse mvc multimodule project. I maven installed the core and then maven jetty7:run on web (initially I ran mvn install on root folder and then I tied to mvn tomcat:run on the same folder. But it has to be done as below.
mvn install on core folder
mvn tomcat7:run on web folder
I initially got an error like missing prefix "Tomcat7". I resolved it by adding the following plugin to the pom in web.
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
And that error was resolved. But I was unsure about that because I can add the plugin to the parent pom. Then I ran again mvn tomcat7:run on web file and now I am getting the following error.
[INFO] >>> tomcat7-maven-plugin:2.0:run (default-cli) # test-web >>>
[WARNING] The POM for org.aspectj:aspectjweaver:jar:1.8.0.M1 is missing, no depe
ndency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
I am not sure where to add the dependency to which pom. I would like know some basics of how the poms can work together to do the installation. For example, There is also a parent pom. But I am not doing a mvn install or anything on the parent pom. I am going to the core and do a mvn install and then go to the web and do a mvn tomcat7:run
I this case how the parent pom contribute to the installation and ruining process? and how should I resolve the above warning and resolve the error.
Some informative answer is very much appreciated. Thanks
You should add the Tomcat plugin to the web project as it will only work in a project that's type "war". There should already be a jetty plugin configured, so "mvn jetty:run" should work from the web folder.

Building an Eclipse plugin using Maven

I am trying to configure Maven to build an Eclipse application (Eclipse plugin packaged with all of the Eclipse EXEs etc).
I have already Mavenised dozens of dependencies of the project and deployed them to our internal Nexus (OSS) server. I have also installed the Nexus P2 Repository Plugin and the P2 Bridge Plugin (2.6.3-01) and the Nexus Unzip Plugin (0.12.0). I can browse to the .meta/p2 folder of our group repository, but it is currently empty.
This should be a lot simpler than it currently appears to be. I'm targeting Eclipse 3.4.2 (Ganymede) on Windows. If it makes any difference, we actually deploy our application packaged as a stripped-down/customised Eclipse installation.
eclipse-repository
When I run maven against a pom with <packaging>eclipse-repository</packaging> I get the following error:
[ERROR] Missing requirement: MyApp 0.0.0 requires
'org.eclipse.equinox.executable.feature.group 0.0.0'
but it could not be found
...where do I get that from, and how do I add it to Nexus?
When I run maven against a pom with <packaging>eclipse-plugin</packaging> I get the following error:
[ERROR] Missing requirement: MyApp 0.0.0 requires
'bundle org.eclipse.ui 0.0.0'
but it could not be found
...but I found the following directories on my local file system (suspect itp-04-rcp generated the first one):
D:\maven\repository\p2\osgi\bundle\org.eclipse.ui\3.6.2.M20110203-1100
D:\maven\repository\p2\osgi\bundle\org.eclipse.ui\3.7.0.v20110928-1505
Tycho POM-First artifacts
I've also tried the pom-first-dependencies and manifest-first-dependency combo: http://wiki.eclipse.org/Tycho/How_Tos/Dependency_on_pom-first_artifacts
I don't understand how this works - I can build itp02 from Git. I can see that it builds two bundles:
+---------------------+---------------------+--------------------------------------+
| artifactId | Bundle-Name | Bundle-SymbolicName |
+---------------------+---------------------+--------------------------------------+
| pomfirst-bundle | pomfirst-bundle | tycho.demo.itp02.pomfirst-bundle |
| pomfirst-thirdparty | pomfirst-thirdparty | tycho.demo.itp02.pomfirst-thirdparty |
+---------------------+---------------------+--------------------------------------+
...but how does build02 pick these up? The only bit that seems relevant is:
Import-Package: tycho.demo.itp02.pomfirst
...that doesn't have anything to do with either of the Bundle-Names.
Felix Maven Bundle Plugin
I tried the Felix maven-bundle-plugin. I include all of my regular maven dependencies in a pom with <packaging>bundle</packaging>.
mvn deploy creates something at /nexus/content/repositories/snapshots/.meta/p2/plugins. I can download the jar via a browser, but all of the dependency jars are named "artifact-vresion" rather than "artifact_version" - is that right?
mvn bundle:bundleall creates an OSGI bundle for each of the transitive dependencies, but I'm not sure what to do with them from here.
mvn bundle:deploy refuses to do anything unless I specify -DremoteOBR and probably a few other parameters which I don't really understand.
The 'org.eclipse.equinox.executable.feature.groug' seems to be necessary if you build an eclipse product which includes the native launchers ("include laucher" property set to true in product configuration). Try to add the feature to your platform definition (e.g. copy from eclipse p2 repo or your running eclipse IDE).
See also https://bugs.eclipse.org/bugs/show_bug.cgi?id=407272
Regards,
Paolo
To solve the Problem concerning the missing dependencies:
[ERROR] Missing requirement: MyApp 0.0.0 requires
'bundle org.eclipse.ui 0.0.0'
but it could not be found
seems that your Feature/Plugin MyApp requires to download the org.eclipse.ui Plug-in before it can be installed.
You should check your settings from your configuration-pom like this:
<properties>
<tycho.version>0.25.0</tycho.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<repository.url>http://download.eclipse.org/releases/neon</repository.url>
</properties>
<repositories>
<repository>
<id>NeonRepository</id>
<url>${repository.url}</url>
<layout>p2</layout>
</repository>
if you have set up your self-hosted p2 repository, make sure that the page is correctly build.
You can check this if you select(in eclipse) Help -> Install New Software.
Eclipse should show the provided parts.
If nothing is shown, even if you have deselected every checkbox, you should check your p2-repository.
It should contain the "features" and "plugins" container as well as the artifacts.jar and content.jar.
If you have only the two folders, you should run
eclipse -application org.eclipse.equinox.p2.publisher.UpdateSitePublisher
-metadataRepository file:/<some location>/repository
-artifactRepository file:/<some location>/repository
-source /<location with a site.xml>
-configs gtk.linux.x86
-compress
-publishArtifacts
in a CLI/Shell.
For more Information check the eclipse documentation.
Can you make maven/tycho instantiate a target platform against which you can build your source plugins? http://www.vogella.com/articles/EclipseTycho/article.html

Errors in pom.xml with dependencies (Missing artifact...)

A friend has passed me a Maven project that I'm trying to run locally in my computer. All that I have done in Eclipse, I selected:
File -> Import -> Existing Maven Projects
After that, the project showed me 4 errors in my pom.xml (Missing artifact..):
I tried removing the content of .m2 folder and then in Eclipse I clicked on my project and chose "Run as" -> "Maven clean" and then "Run as" -> "Maven install". But I still have the same errors. I'm new with Spring so I dont know what else to do.
EDIT:
When I try to do: run as/ maven install, this is what my console says:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building DataLayer 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for javax.persistence:javax.persistence:jar:1.0.0 is missing, no dependency information available
[WARNING] The POM for hibernate-core:hibernate-core:jar:4.2.1.Final is missing, no dependency information available
[WARNING] The POM for hibernate-commons-annotations:hibernate-commons-annotations:jar:4.0.1.Final is missing, no dependency information available
[WARNING] The POM for jboss-logging:jboss-logging:jar:3.1.0.CR2 is missing, no dependency information available
[WARNING] The POM for jta:jta:jar:1.1 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.065s
[INFO] Finished at: Wed Aug 07 11:41:45 VET 2013
[INFO] Final Memory: 4M/90M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project DataLayer: Could not resolve dependencies for project SocialManager:DataLayer:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: javax.persistence:javax.persistence:jar:1.0.0, hibernate-core:hibernate-core:jar:4.2.1.Final, hibernate-commons-annotations:hibernate-commons-annotations:jar:4.0.1.Final, jboss-logging:jboss-logging:jar:3.1.0.CR2, jta:jta:jar:1.1: Failure to find javax.persistence:javax.persistence:jar:1.0.0 in http://repository.jboss.org/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of JBoss repository has elapsed or updates are forced -> [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.
EDIT2: This is my complete pom.xml: https://dl.dropboxusercontent.com/u/31349296/pom.xml It looks pretty awful when I try to paste the code here.
It seemed that a lot of dependencies were incorrect.
Download the whole POM here
A good place to look for the correct dependencies is the Maven Repository website.
I know it is an old question. But I hope my answer will help somebody. I had the same issue and I think the problem is that it cannot find those .jar files in your local repository. So what I did is I added the following code to my pom.xml and it worked.
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
It means maven is not able to download artifacts from repository.
Following steps will help you:
Go to repository browser and check if artifact exist.
Check settings.xml to see if proper respository is specified.
Check proxy settings.
This is a very late answer,but this might help.I went to this link and searched for ojdbc8(I was trying to add jdbc oracle driver)
When clicked on the result , a note was displayed like this:
I clicked the link in the note and the correct dependency was mentioned like below
I was running into this trying to resolve a separate issue with a Maven/Java/Selenium/Cucumber project. For some reason, even though the Maven repo page for com.google.guava snippet had this in it, I resolved this by removing bundle from it.
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
<!--type>bundle</type-->
</dependency>
Exact error message:
Missing artifact com.google.guava:guava:bundle:31.1-jre
I also found this article helpful.
How to Debug Dependency Conflicts in Maven and Gradle
I somehow had this issue after I lost internet connection. I was able to fix it by updating the Maven indexes in Eclipse and then selecting my project and updating the Snapshots/releases.
SIMPLE..
First check with the closing tag of project. It should be placed after all the dependency tags are closed.This way I solved my error.
--Sush
happy coding :)
In my case, My STS was pointing to JRE. I have modified the build path to connect with JDK.
Once I connected to JDK, the pom.xml issue was resolved.

Maven3.0.3 + artifactory 2.5 + ubuntu 11.10 Failed to resolve dependency

I just have this weird problem using maven + artifactory. I have a project which I first build using maven-compiler 2.3.2, and maven2. It build successfully and I was able to deploy in artifatory 2.5.
Eventually I've added several modules and one requires the use of maven-compiler-plugin 2.4, which also requires me to install maven3, because I'm having several errors otherwise. So my app is working again.
But when I checkout on a new machine and maven compiles, I got the ff error:
Could not resolve dependencies for project com.xxxjar:0.0.1-SNAPSHOT: Failed to collect depend
encies for <list of jars>. Failure to find <snapshot> in <repo> was cached in the local repository, resolution will not be reattempted until the update interval of <repo> has elapsed or updates are forced.
What's weird is that when I carry over, my m2 directory from the first machine where I have first develop with maven2, it compiles without error. So clearly some setting or jar is being missed by maven3?
Also I tried setting my snapshot repository "maven snapshot version" setting to Unique as stated from other forums. I also tried almost all possible combinations that I can configure in artifactory repository setting.
My pom.xml distribution setting:
<distributionManagement>
<!-- <repository>
<id>release</id>
<name>xx</name>
<url>xx-repo-release</url>
</repository> -->
<snapshotRepository>
<id>snapshots</id>
<name>xx</name>
<url>xx-snapshots</url>
</snapshotRepository>
</distributionManagement>
Additional info:
When I run install in another machine I have:
2012-05-25 17:21:32,316 [pool-1-thread-3] [WARN ] (o.a.e.DownloadServiceImpl:343) - Sending HTTP error code 409: The repository 'xx-repo-release' rejected the artifact 'xx-repo-release:com/xx/xx/0.0.1-SNAPSHOT/xx-0.0.1-SNAPSHOT.pom' due to its snapshot/release handling policy..
2012-05-25 17:21:32,342 [pool-1-thread-13] [WARN ] (o.a.e.DownloadServiceImpl:343) - Sending HTTP error code 409: The repository 'xx-repo-release' rejected the artifact 'xx-repo-release:com/xx/xx/0.0.1-SNAPSHOT/xx-0.0.1-SNAPSHOT.pom' due to its snapshot/release handling policy..
2012-05-25 17:21:32,350 [pool-1-thread-7] [WARN ] (o.a.e.DownloadServiceImpl:343) - Sending HTTP error code 409: The repository 'libs-release-local' rejected the artifact 'libs-release-local:com/xx/xx/0.0.1-SNAPSHOT/xx-0.0.1-SNAPSHOT.pom' due to its snapshot/release handling policy..
settings.xml are the same for both machine. And also same version of maven. Why is it pointing to release?
Thanks,
czetsuya
I think another solution might be to run the following command:
mvn clean install -U
The problem is dependency issue. I have a model module which is under a parent pom project. While I was able to deploy the model module in the remote repository, I forgot to deploy it's parent which causes the problem.
Solution: http://czetsuya-tech.blogspot.com/2012/05/could-not-resolve-dependencies-for.html
I have pointed to an artifactory 3.1.1.1 instalation and have the above problem in a project who declare the dependency for log4j:log4j:1.2.17.
When a looked for that dependency on artifactory in GAVC search only appears the pom in the jcenter-cache repo.
The solution for me was running the following command:
mvn clean install -U
After that a looked again for log4j:log4j:1.2.17 with GAVC and now appears pom an jar. Of course in my laptop on $HOME/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar was downloaded.
Thanks to mike.tihonchik.

Resources