maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rcbandit <peter.pen...@gmail.com>
Subject Cannot compile bundle with maven-assembly-plugin version 2.5.4
Date Sat, 09 May 2015 13:19:19 GMT
Ref
http://stackoverflow.com/questions/30140331/cannot-compile-bundle-with-maven-assembly-plugin-version-2-5-4

I can't compile properly bundle with maven-assembly-plugin version 2.5.4


?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>Bundle_Loader</groupId>
    <artifactId>System_Install</artifactId>
    <name>System_Install</name>
    <packaging>bundle</packaging>
    <version>1.0</version>
    <dependencies>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>5.0.0</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.framework</artifactId>
            <version>5.0.0</version>
            <type>jar</type>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.5.4</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Import-Package>
                            org.osgi.framework,
                            javax.xml.bind,
                            javafx.collections
                        </Import-Package>
                       
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                       
<Bundle-Activator>org.osgi.system.activator.Activator</Bundle-Activator>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                            <mainClass>org.osgi.system.main.Main</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>                    
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.5.4</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>org.osgi.system.main.Main</mainClass>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.7</version>
                <executions>
                    <execution>
                        <id>copy-resources01</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                           
<outputDirectory>${basedir}/target/classes</outputDirectory>
                            <encoding>UTF-8</encoding>
                            <resources>
                                <resource>
                                    <directory>${basedir}/src</directory>
                                    <includes>
                                        <include>**/*.properties</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-resources02</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                           
<outputDirectory>${basedir}/../../build</outputDirectory>
                            <encoding>UTF-8</encoding>
                            <resources>
                                <resource>
                                   
<directory>${basedir}/target/</directory>
                                    <include>*.jar</include>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>            
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>glassfish-repo</id>
            <name>The Glassfish repository</name>
            <url>http://download.java.net/maven/glassfish/</url>
        </repository>
        <repository>
            <id>glassfish-nexus-repo</id>
            <name>Nexus repository collection for Glassfish</name>
            <url>http://maven.glassfish.org/content/groups/glassfish</url>
        </repository>
    </repositories>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
</project>


I get this error stack during the compilation:



Failed to execute goal
org.apache.maven.plugins:maven-assembly-plugin:2.5.4:single (default) on
project System_Install: Failed to create assembly: Error creating assembly
archive jar-with-dependencies: Problem creating jar:
jar:file:/D:/NetBeansProjects/dx57__T/DX-57-Kernel/System_Install/target/System_Install-1.0.jar!/META-INF/maven/Bundle_Loader/System_Install/pom.properties:
JAR entry META-INF/maven/Bundle_Loader/System_Install/pom.properties not
found in
D:\NetBeansProjects\dx57__T\DX-57-Kernel\System_Install\target\System_Install-1.0.jar
-> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
goal org.apache.maven.plugins:maven-assembly-plugin:2.5.4:single (default)
on project System_Install: Failed to create assembly: Error creating
assembly archive jar-with-dependencies: Problem creating jar:
jar:file:/D:/NetBeansProjects/dx57__T/DX-57-Kernel/System_Install/target/System_Install-1.0.jar!/META-INF/maven/Bundle_Loader/System_Install/pom.properties
    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.MojoExecutor.executeForkedExecutions(MojoExecutor.java:365)
    at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:199)
    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:320)
    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:62)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    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: Failed to create
assembly: Error creating assembly archive jar-with-dependencies: Problem
creating jar:
jar:file:/D:/NetBeansProjects/dx57__T/DX-57-Kernel/System_Install/target/System_Install-1.0.jar!/META-INF/maven/Bundle_Loader/System_Install/pom.properties
    at
org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:541)
    at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 23 more
Caused by:
org.apache.maven.plugin.assembly.archive.ArchiveCreationException: Error
creating assembly archive jar-with-dependencies: Problem creating jar:
jar:file:/D:/NetBeansProjects/dx57__T/DX-57-Kernel/System_Install/target/System_Install-1.0.jar!/META-INF/maven/Bundle_Loader/System_Install/pom.properties
    at
org.apache.maven.plugin.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:185)
    at
org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:484)
    ... 25 more
Caused by: org.codehaus.plexus.archiver.ArchiverException: Problem creating
jar:
jar:file:/D:/NetBeansProjects/dx57__T/DX-57-Kernel/System_Install/target/System_Install-1.0.jar!/META-INF/maven/Bundle_Loader/System_Install/pom.properties
    at
org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:1007)
    at
org.apache.maven.plugin.assembly.archive.archiver.AssemblyProxyArchiver.createArchive(AssemblyProxyArchiver.java:437)
    at
org.apache.maven.plugin.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:181)
    ... 26 more
Caused by: java.io.IOException:
jar:file:/D:/NetBeansProjects/dx57__T/DX-57-Kernel/System_Install/target/System_Install-1.0.jar!/META-INF/maven/Bundle_Loader/System_Install/pom.properties
    at
org.codehaus.plexus.components.io.resources.PlexusIoURLResource.getContents(PlexusIoURLResource.java:44)
    at
org.codehaus.plexus.components.io.resources.Deferred.getContents(Deferred.java:60)
    at
org.codehaus.plexus.components.io.resources.proxy.ResourceInvocationHandler.invoke(ResourceInvocationHandler.java:62)
    at com.sun.proxy.$Proxy18.getContents(Unknown Source)
    at
org.codehaus.plexus.archiver.ArchiveEntry.getInputStream(ArchiveEntry.java:126)
    at
org.codehaus.plexus.archiver.zip.AbstractZipArchiver.zipFile(AbstractZipArchiver.java:514)
    at
org.codehaus.plexus.archiver.zip.AbstractZipArchiver.addResources(AbstractZipArchiver.java:370)
    at
org.codehaus.plexus.archiver.zip.AbstractZipArchiver.createArchiveMain(AbstractZipArchiver.java:326)
    at
org.codehaus.plexus.archiver.zip.AbstractZipArchiver.execute(AbstractZipArchiver.java:227)
    at
org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:990)
    ... 28 more
Caused by: java.io.FileNotFoundException: JAR entry
META-INF/maven/Bundle_Loader/System_Install/pom.properties not found in
D:\NetBeansProjects\dx57__T\DX-57-Kernel\System_Install\target\System_Install-1.0.jar
    at
sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:142)
    at
sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:150)
    at java.net.URL.openStream(URL.java:1038)
    at
org.codehaus.plexus.components.io.resources.PlexusIoURLResource.getContents(PlexusIoURLResource.java:40)
    ... 37 more




I also tested this code with maven-assembly-plugin 2.5.3 and it works fine.
Can you give me some idea how to fix this issue. Look like this is a plugin
problem to me.

Is there any workaround?




--
View this message in context: http://maven.40175.n5.nabble.com/Cannot-compile-bundle-with-maven-assembly-plugin-version-2-5-4-tp5835092.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message