0

发现maven很难用于简单的事情,比如jar-signing..可能是我做错了,纠正我。

我已经生成了一个keystore文件,它位于我的src/main/keystore/mykey.keystore...

我的 POM 看起来像:

  <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>   
        <executions>
        <execution>
        <goals>
            <goal>sign</goal>
        </goals>
        </execution>
       </executions>
       <configuration>
        <keystore>src/main/keystore/mykey.keystore</keystore>
        <alias>aliasname</alias>
        <storepass>password</storepass>         
    </configuration>        
    </plugin>
        <plugin>
         <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>      
    <executions>
    <execution>
    <id>jar-with-dependencies</id>
    <phase>package</phase>
    <goals>
      <goal>single</goal>
    </goals>       
    <configuration>                         
       <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
       </descriptorRefs>           
     <appendAssemblyId>false</appendAssemblyId>
     </configuration>
    </execution>     
  </executions>      
</plugin>   

当我跑mvn:install ..

 Executing: cmd.exe /X /C ""C:\Program Files (x86)\Java\jdk1.6.0\jre\..  
 \bin\jarsigner.exe" -verify S:\Test-API\testapplet\target\appletbio-0.0.1-SNAPSHOT.jar"
 [info] jar is unsigned. (signatures missing or not parsable)
 [INFO] jarsigner: unable to sign jar: java.util.zip.ZipException: duplicate entry:    
 META-INF/maven/    

...

 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.2:sign 
 (default) on project
4

1 回答 1

2

嗯..很简单..我需要使用

   <phase>prepare-package</phase>

代替

    <phase>package</phase>

这个SO Anwser

于 2012-07-23T07:03:43.087 回答