JarJar - 无法JarJar / Embedded错误:ZIP文件必须至少有一个条目

时间:2011-07-23 01:38:56

标签: maven jarjar

我现在在Maven项目中遇到了JarJar最奇怪的错误。它不断吐出以下错误:

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Unable to JarJar: /home/rfkrocktk/Documents/Projects/Work/helloworld-mastercontrol/target/helloworld-mastercontrol-0.0.1-SNAPSHOT.jar

Embedded error: ZIP file must have at least one entry
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Unable to JarJar: /home/rfkrocktk/Documents/Projects/Work/helloworld-mastercontrol/target/helloworld-mastercontrol-0.0.1-SNAPSHOT.jar
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to JarJar: /home/rfkrocktk/Documents/Projects/Work/helloworld-mastercontrol/target/helloworld-mastercontrol-0.0.1-SNAPSHOT.jar
        at com.tonicsystems.jarjar.JarJarMojo.execute(JarJarMojo.java:238)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        ... 17 more
Caused by: java.util.zip.ZipException: ZIP file must have at least one entry
        at java.util.zip.ZipOutputStream.finish(ZipOutputStream.java:321)
        at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:163)
        at java.util.zip.ZipOutputStream.close(ZipOutputStream.java:338)
        at com.tonicsystems.jarjar.util.StandaloneJarProcessor.run(StandaloneJarProcessor.java:65)
        at com.tonicsystems.jarjar.JarJarMojo.execute(JarJarMojo.java:205)
        ... 19 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12 seconds
[INFO] Finished at: Fri Jul 22 18:29:21 PDT 2011
[INFO] Final Memory: 31M/352M
[INFO] ------------------------------------------------------------------------

看看我的构建文件,很清楚ZIP将包含多个文件:

<?xml version="1.0"?>
<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>com.helloworld.wowza</groupId>
    <artifactId>helloworld-mastercontrol</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <properties>
        <restlet.framework.version>2.0.6</restlet.framework.version>
        <spring.framework.version>3.0.1.RELEASE</spring.framework.version>
        <hibernate.framework.version>3.6.5.Final</hibernate.framework.version>
    </properties>

    <dependencies>
        <!-- Wowza Dependencies -->
        <!--    to insert these dependencies, simply run the following
                    mvn install:install-file -DgroupId=com.wowza.wms \
                     -DartifactId=wms-core -Dversion=2.2.4 \
                     -Dpackaging=jar -DgeneratePom=true \ 
                     -Dfile=/usr/local/WowzaMediaServer/lib/wms-core.jar 

                    mvn install:install-file -DgroupId=com.wowza.wms \
                     -DartifactId=wms-server -Dversion=2.2.4 \
                     -Dpackaging=jar -DgeneratePom=true \
                     -Dfile=/usr/local/WowzaMediaServer/lib/wms-server.jar -->
        <dependency>
            <groupId>com.wowza.wms</groupId>
            <artifactId>wms-core</artifactId>
            <version>2.2.4</version>
        </dependency>
        <dependency>
            <groupId>com.wowza.wms</groupId>
            <artifactId>wms-server</artifactId>
            <version>2.2.4</version>
        </dependency>

        <!-- Restlet Dependencies -->
        <dependency>
            <groupId>org.restlet.jee</groupId>
            <artifactId>org.restlet</artifactId>
            <version>${restlet.framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.restlet.jee</groupId>
            <artifactId>org.restlet.ext.jaxb</artifactId>
            <version>${restlet.framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.restlet.jee</groupId>
            <artifactId>org.restlet.ext.jaxrs</artifactId>
            <version>${restlet.framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.restlet.jee</groupId>
            <artifactId>org.restlet.ext.json</artifactId>
            <version>${restlet.framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.restlet.jee</groupId>
            <artifactId>org.restlet.ext.slf4j</artifactId>
            <version>${restlet.framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.restlet.jee</groupId>
            <artifactId>org.restlet.ext.spring</artifactId>
            <version>${restlet.framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.restlet.jee</groupId>
            <artifactId>org.restlet.ext.xml</artifactId>
            <version>${restlet.framework.version}</version>
        </dependency>

        <!-- Spring Dependencies -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${spring.framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <version>${spring.framework.version}</version>
        </dependency>       
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${spring.framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${spring.framework.version}</version>
        </dependency>

        <!-- Hibernate Dependencies -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-c3p0</artifactId>
            <version>${hibernate.framework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-ehcache</artifactId>
            <version>${hibernate.framework.version}</version>
        </dependency>

        <!-- Database Dependencies -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.16</version>
        </dependency>
        <dependency>
            <groupId>org.xerial</groupId>
            <artifactId>sqlite-jdbc</artifactId>
            <version>3.7.2</version>
        </dependency>
        <dependency>
            <groupId>c3p0</groupId>
            <artifactId>c3p0</artifactId>
            <version>0.9.1.2</version>
        </dependency>

        <!-- Logging Dependencies -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.1</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>0.9.28</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>0.9.28</version>
        </dependency>

        <!-- Test Dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${spring.framework.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>jboss-public-repository</id>
            <name>JBoss Public Maven Repository Group</name>
            <url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
            <layout>default</layout>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>springsource-public-repository</id>
            <name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
            <url>http://repository.springsource.com/maven/bundles/release</url>
        </repository>

        <repository>
            <id>springsource-external-repository</id>
            <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
            <url>http://repository.springsource.com/maven/bundles/external</url>
        </repository>

        <repository>  
            <id>restlet-repository</id>  
            <name>Public online Restlet repository</name>  
            <url>http://maven.restlet.org</url>  
        </repository>  
    </repositories>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>jarjar-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jarjar</goal>
                        </goals>
                        <configuration>
                            <projectPackage>com.helloworld.wowza.mastercontrol</projectPackage>
                            <excludes>
                                <exclude>com.wowza.wms:wms-core</exclude>
                                <exclude>com.wowza.wms:wms-server</exclude>
                                <exclude>junit:junit</exclude>
                                <exclude>org.springframework:spring-test</exclude>
                            </excludes>
                            <rules>
                                <rule>
                                    <pattern>*.**</pattern>
                                    <result>@0</result>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

我做错了什么?可以在here找到构建的完整日志。此外,我的项目树可以找到here。谁能看到问题出在哪里?

1 个答案:

答案 0 :(得分:0)

使用调试标志重新运行Maven并查看插件正在做什么。