Question

Have found maven to use hard for simple things like jar-signing..May be I am doing this in wrong way,Correct me.

I have genereated a keystore file and it is located in my src/main/keystore/mykey.keystore...

My POM looks like :

  <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>   

when i run 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
Was it helpful?

Solution

Huh..It was simple..I need to use

   <phase>prepare-package</phase>

instead of

    <phase>package</phase>

This SO Anwser

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top