You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by kato <Ja...@smartstream-stp.com> on 2012/04/05 16:03:54 UTC

features-maven-plugin doesn't add transitive dependency if not a bundle

Hi,
I'm new to serviceMix and have been having trouble with dependencies. 

I’m using ServiceMix 4.4 on Windows XP with Java 1.6.

I am trying to create a features.xml using the features-maven-plugin version
2.2.5. The project has about 10 dependencies and then another 20-30
transitive dependencies.

The plugin seems to build the file, but the file does not have all the
dependencies. 

There are several WARNINGs produced during the creation, e.g. 

[WARNING]   Unable to find suitable bundle for dependency
org.aopalliance.aop ([1.0.0,2.0.0)) (required by spring-aop)

This seems to prevent the addition of the dependency to the features file.
This warning seems strange for 2 reasons:

1)	The plugin seems to require the transitive dependency to exist as a
bundle, while the direct dependencies can be normal JARs
2)	The aopalliance/aop dependency is specified using the aopalliance groupId
and not org.aopalliance

Here is the relevant text from my pom.xml:

	<repositories>
		<repository>
			<id>com.springsource.repository.bundles.release</id>
			<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle
Releases</name>
			<url>http://repository.springsource.com/maven/bundles/release</url>
		</repository>
		<repository>
			<id>com.springsource.repository.bundles.external</id>
			<name>SpringSource Enterprise Bundle Repository - External Bundle
Releases</name>
			<url>http://repository.springsource.com/maven/bundles/external</url>
		</repository>
	</repositories>
	 
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.10</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>3.1.0.RELEASE</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>3.1.0.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>3.1.0.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-orm</artifactId>
			<version>3.1.0.RELEASE</version>
		</dependency>
		
		<dependency>
			<groupId>commons-dbcp</groupId>
			<artifactId>commons-dbcp</artifactId>
			<version>1.3</version>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-entitymanager</artifactId>
			<version>4.0.1.Final</version>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-ehcache</artifactId>
			<version>4.0.1.Final</version> 
		</dependency>
		<dependency>
			<groupId>cglib</groupId>
			<artifactId>cglib-nodep</artifactId>
			<version>2.2.2</version>
		</dependency>
		<dependency>
			<groupId>commons-logging</groupId>
			<artifactId>commons-logging</artifactId>
			<version>1.1</version>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.3.2</version>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<version>2.2.0</version>
				<configuration>
					<instructions>
						<Bundle-Name>${project.artifactId}</Bundle-Name>
					
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
						<Bundle-Description>${project.name}</Bundle-Description>
						<Import-Package>*</Import-Package> 
						<Include-Resource>src/main/resources</Include-Resource>
						<Export-Package>com.xyz.control</Export-Package>
					</instructions>
				</configuration>
				<extensions>true</extensions>
			</plugin> 
			<plugin>
				<groupId>org.apache.karaf.tooling</groupId>
				<artifactId>features-maven-plugin</artifactId>
				<version>2.2.5</version>
				<executions>
					<execution>
						<id>create-feature</id>
						<goals>
							<goal>generate-features-xml</goal>
						</goals>
						<configuration>
							
							<outputFile>target/features.xml</outputFile>
						</configuration>
					</execution>
				</executions>
			</plugin> 
		</plugins>
	</build>

I have tried adding the <kernelVersion> configuration. This reduces the
features in my features file, so that they do not install:

karaf@root> features:list | grep repo
[uninstalled] [4.10           ] junit                                repo-0
[uninstalled] [3.1.0.RELEASE  ] spring-test                          repo-0
[uninstalled] [3.1.0.RELEASE  ] spring-context                       repo-0
[uninstalled] [3.1.0.RELEASE  ] spring-jdbc                          repo-0
[uninstalled] [3.1.0.RELEASE  ] spring-orm                           repo-0
[uninstalled] [1.3            ] commons-dbcp                         repo-0
[uninstalled] [4.0.1.Final    ] hibernate-entitymanager              repo-0
[uninstalled] [4.0.1.Final    ] hibernate-ehcache                    repo-0
[uninstalled] [2.2.2          ] cglib-nodep                          repo-0
[uninstalled] [1.1            ] commons-logging                      repo-0
karaf@root> features:install spring-jdbc/3.1.0.RELEASE
spring-orm/3.1.0.RELEASE spring-context
Error executing command: Could not start bundle
wrap:mvn:org.springframework/spring-tx/3.1.0.RELEASE in feature(s)
spring-test-3.1.0.RELEASE, spring-jdbc-3.
1.0.RELEASE: Unresolved constraint in bundle org.springframework.transaction
[294]: Unable to resolve 294.0: missing requirement [294.0] package;
(&(package
=org.springframework.beans)(version>=3.1.0)(!(version>=3.1.1)))

Can someone please explain what I am missing? How can I create a
features.xml with all the dependencies from my project?

Also, why is there a difference when adding the <kernelVersion>
configuration?

Thanks for any help
Kato


--
View this message in context: http://karaf.922171.n3.nabble.com/features-maven-plugin-doesn-t-add-transitive-dependency-if-not-a-bundle-tp3887316p3887316.html
Sent from the Karaf - User mailing list archive at Nabble.com.