Ivy converts pom.xml-Package-Tag into ivy.xml-Extension - ivy

Problem
When using Jenkins Shared Libraries I try to #Grab('com.atlassian.jira:jira-rest-java-client-core:4.0.0'). This miserably fails while ivy tries to fetch dependencies:
General error during conversion: Error grabbing Grapes -- [download failed: com.atlassian.sal#sal-api;3.0.3!sal-api.atlassian-plugin, download failed: com.atlassian.httpclient#atlassian-httpclient-plugin;0.23.0!atlassian-httpclient-plugin.atlassian-plugin]
As far as I understand, this happens by the following reason:
Ivy downloads the pom.xml files for the dependencies, converts them into ivy files and downloads the corresponding artifacts. These dependencies state a <packaging>atlassian-plugin</packaging> in their pom.xml, which is converted into <artifact name="atlassian-httpclient-plugin" type="atlassian-plugin" ext="atlassian-plugin" conf="master"/>. Ivy tries to download *.atlassian-plugin files now instead of *.jar.
Is this a bug in ivy, that should be reported? Or is atlassian missusing the packageing-Tag?
Minimal example for reproduction
I can reproduce the problem independently from jenkins using ant/ivy locally with the following files.
[ivy:retrieve] :: problems summary ::
[ivy:retrieve] :::: WARNINGS
[ivy:retrieve] [NOT FOUND ] com.atlassian.sal#sal-api;3.0.3!sal-api.atlassian-plugin (1041ms)
[ivy:retrieve] ==== atlassian: tried
[ivy:retrieve] https://packages.atlassian.com/mvn/maven-external/com/atlassian/sal/sal-api/3.0.3/sal-api-3.0.3.atlassian-plugin
[ivy:retrieve] [NOT FOUND ] com.atlassian.httpclient#atlassian-httpclient-plugin;0.23.0!atlassian-httpclient-plugin.atlassian-plugin (147ms)
[ivy:retrieve] ==== atlassian: tried
[ivy:retrieve] https://packages.atlassian.com/mvn/maven-external/com/atlassian/httpclient/atlassian-httpclient-plugin/0.23.0/atlassian-httpclient-plugin-0.23.0.atlassian-plugin
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] :: FAILED DOWNLOADS ::
[ivy:retrieve] :: ^ see resolution messages for details ^ ::
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] :: com.atlassian.sal#sal-api;3.0.3!sal-api.atlassian-plugin
[ivy:retrieve] :: com.atlassian.httpclient#atlassian-httpclient-plugin;0.23.0!atlassian-httpclient-plugin.atlassian-plugin
[ivy:retrieve] ::::::::::::::::::::::::::::::::::::::::::::::
build.xml
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="hello-ivy" default="ivy-get-binaries">
<target name="ivy-get-binaries">
<ivy:settings file="ivysettings.xml" />
<echoproperties prefix="ivy."/>
<ivy:retrieve />
</target>
</project>
ivy.xml
<ivy-module version="2.0">
<info organisation="foo" module="bar"/>
<dependencies>
<dependency org="com.atlassian.jira" name="jira-rest-java-client-core" rev="4.0.0"/>
</dependencies>
</ivy-module>
ivysettings.xml
<ivysettings>
<settings defaultResolver="atlassian"/>
<resolvers>
<ibiblio name="atlassian" m2compatible="true" root="https://packages.atlassian.com/mvn/maven-external" />
</resolvers>
</ivysettings>
Checking with Maven
Resolving the dependencies for jira-rest-java-client-core works fine using Maven:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>foo</groupId>
<artifactId>bar</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>minimal-pom</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-rest-java-client-core</artifactId>
<version>4.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>atlassian</id>
<layout>default</layout>
<url>https://packages.atlassian.com/mvn/maven-external</url>
</repository>
</repositories>
</project>

Related

Maven won't deploy on Sonatype Nexus Repository

[Links are replaced with [http] because StackOverflow does not allow more than 2 links for me...]
I have installed Apache Maven 3.2.3 ([http]maven.apache.org/download.cgi?Preferred=ftp://mirror.reverse.net/pub/apache/), and it has downloaded all core plugins.
Then I installed Sonatype Nenus OSS ([http]www.sonatype.org/nexus/go/) as a WAR application on my XAMPP tomcat server.
Everything is well set and works.
My unique goal here is to test a deployment of a file from my local Maven to my Nexus repository.
Here is my POM file project:
<project xmlns="..."
xmlns:xsi="..."
xsi:schemaLocation="...">
<modelVersion>4.0.0</modelVersion>
<groupId>groupA</groupId>
<artifactId>artifactA</artifactId>
<version>1.0.0</version>
<distributionManagement>
<repository>
<id>releases</id>
<url>[http]localhost:8080/nexus-2.9.2-01/content/repositories/releases</url>
</repository>
</distributionManagement>
</project>
And here is my Maven configuration file: settings.xml
<settings xmlns="..."
xmlns:xsi="..."
xsi:schemaLocation="...">
<servers>
<server>
<id>releases</id>
<username>deployment</username>
<password>deployment123</password>
</server>
</servers>
The account provided is the default one and it works from the Nexus GUI.
My Nexus repository "releases" is configured as following:
[http]i.stack.imgur.com/Nh3dO.png
And when i use the following command:
mvn deploy
Or the following:
mvn deploy:deploy
Which are almost the same as far as I'm concerned...
Maven tells me this:
[http]i.stack.imgur.com/2vBNx.png
And the [Help 1] tells nothing but "see the plugin documentation". And the error message tells me that "The repository element is not specified in the POM file", but it actually is...
I really don't see what i am missing :/
Thanks for your help
Thank you all for your answers. I don't really have an idea why it works, but using these files works:
ArtifactA POM file:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>groupA</groupId>
<artifactId>artifactA</artifactId>
<version>1.2.4</version>
<dependencyManagement>
<dependencies>
</dependencies>
</dependencyManagement>
<distributionManagement>
<repository>
<id>nexus</id>
<name>Nexus Test Repository</name>
<url>http://localhost:8080/nexus-2.9.2-01/content/repositories/releases</url>
</repository>
</distributionManagement>
</project>
ArtifactB POM file:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>groupA</groupId>
<artifactId>artifactB</artifactId>
<version>1.0.0</version>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>groupA</groupId>
<artifactId>artifactA</artifactId>
<version>1.2.4</version>
<type>zip</type>
</dependency>
</dependencies>
</dependencyManagement>
<distributionManagement>
<repository>
<id>nexus</id>
<name>Nexus Test Repository</name>
<url>http://localhost:8080/nexus-2.9.2-01/content/repositories/releases</url>
</repository>
</distributionManagement>
</project>
Maven settings file:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<name>Nexus Test Repository</name>
<url>http://localhost:8080/nexus-2.9.2-01/content/repositories/releases</url>
<mirrorOf>*,!central</mirrorOf>
</mirror>
</mirrors>
</settings>
Deployment script:
mvn deploy:deploy-file \
-Dfile=artifactA_package.zip \
-Dpackaging=zip \
-DpomFile=pomA1.2.4.xml \
-Durl=http://localhost:8080/nexus-2.9.2-01/content/repositories/releases \
-DrepositoryId=nexus
mvn deploy:deploy-file \
-Dfile=artifactB_package.zip \
-Dpackaging=zip \
-DpomFile=pomB1.0.0.xml \
-Durl=http://localhost:8080/nexus-2.9.2-01/content/repositories/releases \
-DrepositoryId=nexus
Hope it will help the next one :)
I use wagon-webdav-jackrabbit pluging in combination with something like your configurations. It enables Maven to deploy artifacts and files to WebDAV enabled servers.
http://maven.apache.org/wagon/wagon-providers/wagon-webdav-jackrabbit/
Paste this in your pom.xml
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
<version>2.4</version>
</extension>
</extensions>
</build>

FATAL ERROR while compiling Project using Maven 2

I am new to Maven and starting moving my project to maven. I have created the following POM.
when i issue install command, it gives me FATAL ERROR.
I am using maven 2.2.1 version and JDK 1.5.
My POM is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<groupId>my.project.group</groupId>
<artifactId>my.artifact</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.5.6.SEC01</version>
</dependency>
</dependencies>
</project>
Thanks for any help.
You are missing a mandatory tag from your project address structure groupId:artifactId:version
Put the following tag after ... with some version info (i.e. 1.x.x) and try.
<version>1.0.0</version>
Reference : http://maven.apache.org/pom.html

Maven Chronos JMeter plugin

Has any one used Chronos for JMeter + Maven plug-in. I am having tough time trying Maven JMeter plug-in and thought of giving it a try
I have following pom set up for chronos but when I execute "mvn verify " I encounter following exception -
#
Maven cannot calculate your build plan, given the following information:
Tasks:
- verify
Current project:
Group-Id: chronos1
Artifact-Id: chronos1
Version: 0.0.1-SNAPSHOT
From file: C:\SelNG\chronos\pom.xml
Error message: Failed to resolve plugin for mojo binding: org.codehaus.mojo:chronos-maven-plugin:1.0-SNAPSHOT:jmeter
Root error message: Unable to download the artifact from any repository
#
Is it because plug-in is not available in repo?
My pom is -
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>chronos1</groupId>
<artifactId>chronos1</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>chronos1</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<jmeter.home>C:/Program Files/jakarta-jmeter-2.4</jmeter.home>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>chronos-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<input>${basedir}/src/jmeter/EducationSSL.jmx</input>
</configuration>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>chronos-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
</plugin>
</plugins>
</reporting>
Thanks
Tarun K
I don't have any particular experience with this plugin but for SNAPSHOT versions of codehaus plugins, you probably need to declare the codehaus snapshot repository:
<project>
...
<pluginRepositories>
<pluginRepository>
<id>snapshots.repository.codehaus.org</id>
<url>http://snapshots.repository.codehaus.org/</url>
</pluginRepository>
...
</pluginRepositories>
...
</project>

How to deploy a specific child project with cargo:start using maven

I have a developed application and I am just trying to make the build process easy. The POM file for parent looks like this:
<parent>
<groupId>com.shc.obu.ca</groupId>
<artifactId>shcobuca-pom</artifactId>
<version>1.1.0</version> </parent>
<groupId>com.shc.obu.ca.osol</groupId> <artifactId>apps-pom</artifactId> <version>${currVersion}</version> <packaging>pom</packaging> <name>Outlet Apps</name>
<scm>
<connection>scm:svn:https://ushofsvpsvn2.intra.searshc.com/svn/outlet/outlet/trunk/apps</connection>
<developerConnection>scm:svn:https://ushofsvpsvn2.intra.searshc.com/svn/outlet/outlet/trunk/apps</developerConnection> </scm>
<profiles>
<profile> <id>www</id>
<activation> <activeByDefault>true</activeByDefault> </activation>
<modules>
<module>www</module>
<module>modules</module>
</modules>
</profile>
<profile>
<id>mts</id>
<activation> <activeByDefault>true</activeByDefault> </activation>
<modules>
<module>mts</module>
<module>modules</module>
</modules>
</profile>
<profile> <id>search</id>
<activation> <activeByDefault>true</activeByDefault> </activation>
<modules>
<module>modules</module>
<module>search</module>
</modules>
</profile> </profiles>
<repositories>
<repository>
<id>obu.ca.repo.release</id>
<snapshots><enabled>false</enabled></snapshots>
<url>http://maven.cal.intra.sears.com/release</url>
</repository>
<repository>
<id>obu.ca.repo.snapshot</id>
<releases><enabled>false</enabled></releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>interval:5</updatePolicy>
</snapshots>
<url>http://maven.cal.intra.sears.com/snapshot</url>
</repository> </repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<env>trunk</env>
<currVersion>1.2.0</currVersion> </properties> </project>
This file shows that it has three profiles which are basically independent child project. I am adding the cargo plugin to this file as below:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0</version>
<configuration>
<container>
<containerId>tomcat6x</containerId>
<home>
C:\tools\apache-tomcat-6.0.26
</home>
</container>
<configuration>
<properties>
<cargo.servlet.port>
8082
</cargo.servlet.port>
<cargo.jvmargs>
"-Xdebug" "-Xrunjdwp:transport=dt_socket,address=4646,server=y,suspend=n"
</cargo.jvmargs>
</properties>
</configuration>
</configuration>
</plugin>
</plugins>
</build>
But when I run 'mvn cargo:start', tomcat instance runs fine but none of the child apps get deployed. Is there a way that I can make my first child application (www) (which generates a war file called www-webapp-1.2.0.war) auto deployed?
Update: Thanks Pascal. I tried modifying the build tag as below:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0</version>
<configuration>
<container>
<containerId>tomcat6x</containerId>
<home>
C:\tools\apache-tomcat-6.0.26
</home>
</container>
<configuration>
<properties>
<cargo.servlet.port>
8082
</cargo.servlet.port>
<cargo.jvmargs>
"-Xdebug" "-Xrunjdwp:transport=dt_socket,address=4646,server=y,suspend=n"
</cargo.jvmargs>
</properties>
<deployables>
<deployable>
<groupId>com.shc.obu.ca.osol</groupId>
<artifactId>www-webapp-1.2.0</artifactId>
<type>war</type>
<properties>
<context>acontext</context>
</properties>
</deployable>
</deployables>
</configuration>
</configuration>
</plugin>
</plugins>
</build>
But still it's not working. It's giving build error as below:
Artifact [com.shc.obu.ca.osol:www-webapp-1.2.0:war] is not a dependency of the project.
I tried 'www-webapp' and 'www' as artifact id as well but the error remained the same.
And when I add the same to dependency tags, it gives some kind of cyclic reference error as below:
'The projects in the reactor contain a cyclic reference'
You need to list your www module as a module to deploy inside a <deployable> element. From the Maven2 Plugin Reference Guide:
If no deployable is specified and the project's packaging is war, ear or ejb and there is no deployer specified then the generated artifact is added automatically to the list of deployables to deploy
Since your project has a packaing of type pom, it is not candidate for deployment and nothing gets deployed.
Here is an example:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0</version>
<configuration>
<container>
<containerId>tomcat6x</containerId>
<home>C:\tools\apache-tomcat-6.0.26</home>
</container>
<configuration>
<properties>
<cargo.servlet.port>8082</cargo.servlet.port>
<cargo.jvmargs>
"-Xdebug" "-Xrunjdwp:transport=dt_socket,address=4646,server=y,suspend=n"
</cargo.jvmargs>
</properties>
<deployables>
<!-- application to deploy -->
<deployable>
<groupId>com.acme</groupId>
<artifactId>mywebapp</artifactId>
<type>war</type>
<properties>
<context>acontext</context>
</properties>
</deployable>
</deployables>
</configuration>
</configuration>
</plugin>
Update:
(...) It's giving build error as below
Artifact [com.shc.obu.ca.osol:www-webapp-1.2.0:war] is not a dependency of the project. I tried 'www-webapp' and 'www' as artifact id as well but the error remained the same.
I forgot about that but it looks like Cargo expect a deployable to be a dependency of the project where Cargo is started.
And when I add the same to dependency tags, it gives some kind of cyclic reference error as below: 'The projects in the reactor contain a cyclic reference'
Which is normal. An artifact can't be a sub-module and a dependency of a given project or you get a cyclic dependency (you need a dependency to build a module which is the dependency, chicken and egg problem).
My suggestion would be to move the cargo configuration to the www module or to create a dedicated module for your functional tests (this is usually what I do) and to declare www as dependency of this module.
Here is a sample of how to do multi-module deployments with Cargo. It has a parent and three modules, where one of them does the deployment of all three with cargo. You can run mvn cargo:run from the third module to get all of them deployed.
==================== PARENT 1 =========================
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.blah.test</groupId>
<artifactId>blah-service</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>blah-service-module1</module>
<module>blah-service-module2</module>
<module>blah-service-module3</module>
</modules>
</project>
==================== MODULE 1 =========================
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.blah.test</groupId>
<artifactId>blah-service</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>blah-service-module1</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
</project>
==================== MODULE 2 =========================
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.blah.test</groupId>
<artifactId>blah-service</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>blah-service-module2</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
</project>
========== MODULE 3: the one which deploys all three with cargo =========================
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.blah.test</groupId>
<artifactId>blah-service</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>blah-service-module3</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.blah.test</groupId>
<artifactId>blah-service-module1</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.blah.test</groupId>
<artifactId>blah-service-module2</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.6</version>
<configuration>
<container>
<containerId>jetty6x</containerId>
<type>embedded</type>
</container>
<deployables>
<deployable>
<groupId>com.blah.test</groupId>
<artifactId>blah-service-module1</artifactId>
<type>war</type>
<properties>
<context>api/blah/module1</context>
</properties>
</deployable>
<deployable>
<groupId>com.blah.test</groupId>
<artifactId>blah-service-module2</artifactId>
<type>war</type>
<properties>
<context>api/blah/module2</context>
</properties>
</deployable>
<deployable>
<groupId>com.blah.test</groupId>
<artifactId>blah-service-module3</artifactId>
<type>war</type>
<properties>
<context>api/blah/module3</context>
</properties>
</deployable>
</deployables>
</configuration>
</plugin>
</plugins>
</build>
</project>

Maven : OSGI, bundles and multi-modules projects

I'm currently developing an OSGi based application (using Equinox) by trying to mavenize a web tutorial I've found on OSGi+Equinox. In this project, there are bundles depending on other bundles (quote-service depends on quote).
The compile phase does succeed, but the package phase does not. Maven complains the following :
[INFO] [bundle:bundle]
[ERROR] Error building bundle de.vogella.osgi:quote-service:bundle:0.0.1 : Unresolved references to [de.vogella.osgi.quote] by class(es) on the Bundle-Classpath[Jar:dot]: [de/vogella/osgi/quoteservice/Activator.class, de/vogella/osgi/quoteservice/QuoteService.class]
[ERROR] Error(s) found in bundle configuration
I do understand the problem, but do not see how to make it work.
This is the quote's pom :
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>osgi-first-app</artifactId>
<groupId>de.vogella.osgi</groupId>
<version>0.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>de.vogella.osgi</groupId>
<artifactId>quote</artifactId>
<packaging>bundle</packaging>
<name>Quote Bundle</name>
<version>0.0.1</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
<_include>src/main/resources/META-INF/MANIFEST.MF</_include>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
and the quote's bundle manifest :
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Quote Plug-in
Bundle-SymbolicName: de.vogella.osgi.quote
Bundle-Activator: de.vogella.osgi.quote.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.osgi.framework;version="1.3.0"
Export-Package: de.vogella.osgi.quote
Then the quote-service's pom :
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>osgi-first-app</artifactId>
<groupId>de.vogella.osgi</groupId>
<version>0.0.1</version>
</parent>
<dependencies>
<dependency>
<groupId>de.vogella.osgi</groupId>
<artifactId>quote</artifactId>
<version>0.0.1</version>
<type>bundle</type>
</dependency>
</dependencies>
<modelVersion>4.0.0</modelVersion>
<groupId>de.vogella.osgi</groupId>
<artifactId>quote-service</artifactId>
<packaging>bundle</packaging>
<name>Quote Service Bundle</name>
<version>0.0.1</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
<_include>src/main/resources/META-INF/MANIFEST.MF</_include>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
And finally the quote-service's manifest :
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Quoteservice Plug-in
Bundle-SymbolicName: de.vogella.osgi.quoteservice
Bundle-Activator: de.vogella.osgi.quoteservice.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.osgi.framework;version="1.3.0", \
de.vogella.osgi.quote;version="0.0.1"
Is there something wrong ? Thank you in advance !
The answer is quite simple : I removed the already defined manifest, and used bnd entries in the bundle plugin instructions. That works !
Tycho is designed to handle these types of problems.
I wrote a tool called auto-builder: http://code.google.com/p/auto-builder. It introspects PDE-based projects and generates Ant build files; it supports transitive closure over dependencies and all that jazz.
I posted a write-up: http://empty-set.net/?p=9. I wrote it because the Maven tools I played with, when integrated with PDE, didn’t “just work.” Basically, I wanted to do coding in PDE and have a Hudson-based CI without any fuss in between.
Generating Ant files is nice because it gives you all the benefits of a declarative build tool, but it leaves you with a procedural description of what it is doing.
I am looking for more PDE-based projects to test it on. There are a couple RFC-0112 Bundle repositories around, and I have some code for downloading dependencies. If anyone is interested, then I could integrate dependencies download with auto-builder.