You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Ryan Heinen (JIRA)" <ji...@apache.org> on 2012/07/05 20:54:34 UTC

[jira] [Created] (FELIX-3585) Dependencies with classes or resources in the default package cannot be embedded

Ryan Heinen created FELIX-3585:
----------------------------------

             Summary: Dependencies with classes or resources in the default package cannot be embedded
                 Key: FELIX-3585
                 URL: https://issues.apache.org/jira/browse/FELIX-3585
             Project: Felix
          Issue Type: Bug
          Components: Maven Bundle Plugin
    Affects Versions: maven-bundle-plugin-2.4.0
            Reporter: Ryan Heinen
            Priority: Critical


I'm testing the latest svn revision 1355520 (2.4.0-SNAPSHOT) of the maven-bundle-plugin in my project. A MojoExecutionException is thrown when the plugin attempts to embed dependencies that contain resources or classes in the default package. The error message that I see in the logs is "Classes found in the wrong directory: {JDOMAbout$Info.class=long, JDOMAbout.class=long, ". Those two classes are in the default package in that version of the jdom jar.

A warning is also thrown about "Unused Private-Package instructions, no such package(s) on the class path: [!*]". I've included more log output after the sample POM below.

This worked without errors or warnings in release version 2.3.7, so I believe this is a bug.

Here is a minimal POM that reproduces the issue. The dependency that I am testing with is jdom 1.0, but it should apply to any jar that has content in the default package. I've reproduced this error on both maven 3.0.3 and 3.0.4.

{code}
<?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>

	<groupId>com.example</groupId>
	<artifactId>jdom-wrapper</artifactId>
	<packaging>bundle</packaging>
	<name>JDOM Wrapper</name>
	<version>1.0-SNAPSHOT</version>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<extensions>true</extensions>
				<version>2.4.0-SNAPSHOT</version>
<!--
				<version>2.3.7</version>
-->
				<configuration>
					<instructions>
						<Embed-Dependency>jdom;scope=compile</Embed-Dependency>
					</instructions>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<dependency>
			<groupId>jdom</groupId>
			<artifactId>jdom</artifactId>
			<version>1.0</version>
		</dependency>
	</dependencies>
</project>
{code}

The last bit of output from a mvn bundle:bundle -debug command.

{code}
[DEBUG] BND Classpath:
#-----------------------------------------------------------------------
-classpath:\
 /private/tmp/jdom/target/classes,\
 /Users/ryan/.m2/repository/jdom/jdom/1.0/jdom-1.0.jar
#-----------------------------------------------------------------------

[DEBUG] BND Manifest:
#-----------------------------------------------------------------------
Manifest-Version: 1.0
Bnd-LastModified: 1341512614042
Bundle-ClassPath: .,jdom-1.0.jar
Bundle-ManifestVersion: 2
Bundle-Name: JDOM Wrapper
Bundle-SymbolicName: com.example.jdom-wrapper
Bundle-Version: 1.0.0.SNAPSHOT
Created-By: 1.6.0_33 (Apple Inc.)
Embed-Dependency: jdom;scope=compile
Embed-Transitive: true
Embedded-Artifacts: jdom-1.0.jar;g="jdom";a="jdom";v="1.0"
Import-Package: javax.xml.parsers,javax.xml.transform,javax.xml.transfor
 m.sax,javax.xml.transform.stream,oracle.xml.parser,oracle.xml.parser.v2
 ,org.apache.xerces.dom,org.apache.xerces.parsers,org.jaxen,org.jaxen.jd
 om,org.w3c.dom,org.xml.sax,org.xml.sax.ext,org.xml.sax.helpers
Tool: Bnd-${Bundle-Version}
#-----------------------------------------------------------------------

[DEBUG] Final Manifest:
#-----------------------------------------------------------------------
Manifest-Version: 1.0
Bnd-LastModified: 1341512614042
Build-Jdk: 1.6.0_33
Built-By: ryan
Bundle-ClassPath: .,jdom-1.0.jar
Bundle-ManifestVersion: 2
Bundle-Name: JDOM Wrapper
Bundle-SymbolicName: com.example.jdom-wrapper
Bundle-Version: 1.0.0.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: jdom;scope=compile
Embed-Transitive: true
Embedded-Artifacts: jdom-1.0.jar;g="jdom";a="jdom";v="1.0"
Import-Package: javax.xml.parsers,javax.xml.transform,javax.xml.transfor
 m.sax,javax.xml.transform.stream,oracle.xml.parser,oracle.xml.parser.v2
 ,org.apache.xerces.dom,org.apache.xerces.parsers,org.jaxen,org.jaxen.jd
 om,org.w3c.dom,org.xml.sax,org.xml.sax.ext,org.xml.sax.helpers
Tool: Bnd-${Bundle-Version}
#-----------------------------------------------------------------------

[WARNING] Bundle com.example:jdom-wrapper:bundle:1.0-SNAPSHOT : Unused Private-Package instructions, no such package(s) on the class path: [!*]
[ERROR] Bundle com.example:jdom-wrapper:bundle:1.0-SNAPSHOT : Classes found in the wrong directory: {JDOMAbout$Info.class=long, JDOMAbout.class=long, JDOMAbout$Author.class=long}
[ERROR] Error(s) found in bundle configuration
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.796s
[INFO] Finished at: Thu Jul 05 11:23:34 PDT 2012
[INFO] Final Memory: 5M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.felix:maven-bundle-plugin:2.4.0-SNAPSHOT:bundle (default-cli) on project jdom-wrapper: Error(s) found in bundle configuration -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.felix:maven-bundle-plugin:2.4.0-SNAPSHOT:bundle (default-cli) on project jdom-wrapper: Error(s) found in bundle configuration
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error(s) found in bundle configuration
	at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:407)
	at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:264)
	at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:255)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
	... 19 more
Caused by: org.apache.maven.plugin.MojoFailureException: Error(s) found in bundle configuration
	at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:356)
	... 23 more
[ERROR] 
[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
{code}


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira