You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Adam <pu...@gmail.com> on 2008/05/21 21:34:38 UTC

Weird Signed Jar Issue

Hey all,

I have a project that is creating a signed JAR off of a JAR built with
dependencies.  Up until recently (for the last year at least) it has
worked fine with my configuration.  All of a sudden it will not build
on Windows (but is fine on Linux).  The error I am getting is:

[INFO] jarsigner: unable to sign jar: java.util.zip.ZipException:
duplicate entry: com/mobilvox/../../applet/...Applet.class
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Result of cmd.exe /X /C '""C:\Program
Files\Java\jdk1.6.0_02\jre\..\bin\jarsigner.exe" -verbose -storepass
****** -keypass ****** -signedjar
C:\dev\workspace\proj-113\..\..\applet\target\signed\...-1.2-SNAPSHOT.jar
C:\dev\workspace\proj-113\...\...target...-1.2-SNAPSHOT-jar-with-dependencies.jar
MobilVox"' execution is: '1'.


When I look at the JAR I do actually have 2 of the .class files but,
the only places they exist are in the JAR in the build output
directory and the other is in buildOutputDirectory/classes

My environment:

Windows XP SP2
Maven 2.0.8
Java 1.6.0_2


Also, here is the pom configuration:

	<build>
		<plugins>
			<plugin>
				<artifactId>maven-assembly-plugin</artifactId>
				<configuration>
					<descriptorRefs>
						<descriptorRef>jar-with-dependencies</descriptorRef>
					</descriptorRefs>
				</configuration>
				<executions>
					<execution>
						<id>make-assembly</id>
						<phase>package</phase>
						<goals>
							<goal>attached</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-jar-plugin</artifactId>
				<configuration>
					<alias>...</alias>
					<keypass>...</keypass>
					<storepass>...</storepass>
					<jarPath>
						${project.build.directory}/${project.build.finalName}-jar-with-dependencies.${project.packaging}
					</jarPath>
					<signedjar>
						${project.build.directory}/signed/${project.build.finalName}.jar
					</signedjar>
					<verify>true</verify>
					<verbose>true</verbose>
					<certs>true</certs>
				</configuration>
				<executions>
					<execution>
						<goals>
							<goal>sign</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

 Again, this works fine in Linux and worked for the last year up until
recently.

Thanks in advance,

Adam Altemus
MobilVox, Inc
http://www.mobilvox.com

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


Re: Weird Signed Jar Issue

Posted by Adam <pu...@gmail.com>.
I found a fix for this.  I figure I'll throw it out in case someone
else runs into this problem.  The fix is to include an assembly
descriptor that excludes the current project I am building the jar
with dependencies in.  Here is the assembly.xml:

<assembly>
  <id>jar-with-dependencies</id>
  <formats>
    <format>jar</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <dependencySets>
    <dependencySet>
	  <unpack>true</unpack>
      <scope>runtime</scope>
      <excludes>
        <exclude>com.mobilvox${project.artifactId}</exclude>
      </excludes>
    </dependencySet>
  </dependencySets>
  <fileSets>
    <fileSet>
      <directory>target/classes</directory>
	  <outputDirectory>/</outputDirectory>
    </fileSet>
  </fileSets>
</assembly>

I would like to know if this is a bug in the assembly plugin or if I
had something wrong from the start that I should have always been
doing this though.

On Thu, May 22, 2008 at 2:36 PM, Adam <pu...@gmail.com> wrote:
> On further investigation, it is a problem with the way the assembly
> plugin setup I have is doing jar-with-dependencies -it's duplicate in
> other projects as well, we just found it now since we are using it to
> create the signed JAR in the other project.  Does anyone have any
> insight as to what is wrong with what I'm doing?
>
> Thanks.
>
> On Wed, May 21, 2008 at 3:34 PM, Adam <pu...@gmail.com> wrote:
>> Hey all,
>>
>> I have a project that is creating a signed JAR off of a JAR built with
>> dependencies.  Up until recently (for the last year at least) it has
>> worked fine with my configuration.  All of a sudden it will not build
>> on Windows (but is fine on Linux).  The error I am getting is:
>>
>> [INFO] jarsigner: unable to sign jar: java.util.zip.ZipException:
>> duplicate entry: com/mobilvox/../../applet/...Applet.class
>> [INFO] ------------------------------------------------------------------------
>> [ERROR] BUILD ERROR
>> [INFO] ------------------------------------------------------------------------
>> [INFO] Result of cmd.exe /X /C '""C:\Program
>> Files\Java\jdk1.6.0_02\jre\..\bin\jarsigner.exe" -verbose -storepass
>> ****** -keypass ****** -signedjar
>> C:\dev\workspace\proj-113\..\..\applet\target\signed\...-1.2-SNAPSHOT.jar
>> C:\dev\workspace\proj-113\...\...target...-1.2-SNAPSHOT-jar-with-dependencies.jar
>> MobilVox"' execution is: '1'.
>>
>>
>> When I look at the JAR I do actually have 2 of the .class files but,
>> the only places they exist are in the JAR in the build output
>> directory and the other is in buildOutputDirectory/classes
>>
>> My environment:
>>
>> Windows XP SP2
>> Maven 2.0.8
>> Java 1.6.0_2
>>
>>
>> Also, here is the pom configuration:
>>
>>        <build>
>>                <plugins>
>>                        <plugin>
>>                                <artifactId>maven-assembly-plugin</artifactId>
>>                                <configuration>
>>                                        <descriptorRefs>
>>                                                <descriptorRef>jar-with-dependencies</descriptorRef>
>>                                        </descriptorRefs>
>>                                </configuration>
>>                                <executions>
>>                                        <execution>
>>                                                <id>make-assembly</id>
>>                                                <phase>package</phase>
>>                                                <goals>
>>                                                        <goal>attached</goal>
>>                                                </goals>
>>                                        </execution>
>>                                </executions>
>>                        </plugin>
>>                        <plugin>
>>                                <artifactId>maven-jar-plugin</artifactId>
>>                                <configuration>
>>                                        <alias>...</alias>
>>                                        <keypass>...</keypass>
>>                                        <storepass>...</storepass>
>>                                        <jarPath>
>>                                                ${project.build.directory}/${project.build.finalName}-jar-with-dependencies.${project.packaging}
>>                                        </jarPath>
>>                                        <signedjar>
>>                                                ${project.build.directory}/signed/${project.build.finalName}.jar
>>                                        </signedjar>
>>                                        <verify>true</verify>
>>                                        <verbose>true</verbose>
>>                                        <certs>true</certs>
>>                                </configuration>
>>                                <executions>
>>                                        <execution>
>>                                                <goals>
>>                                                        <goal>sign</goal>
>>                                                </goals>
>>                                        </execution>
>>                                </executions>
>>                        </plugin>
>>                </plugins>
>>        </build>
>>
>>  Again, this works fine in Linux and worked for the last year up until
>> recently.
>>
>> Thanks in advance,
>>
>> Adam Altemus
>> MobilVox, Inc
>> http://www.mobilvox.com
>>
>
>
>
> --
> Adam
>



-- 
Adam

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


Re: Weird Signed Jar Issue

Posted by Adam <pu...@gmail.com>.
On further investigation, it is a problem with the way the assembly
plugin setup I have is doing jar-with-dependencies -it's duplicate in
other projects as well, we just found it now since we are using it to
create the signed JAR in the other project.  Does anyone have any
insight as to what is wrong with what I'm doing?

Thanks.

On Wed, May 21, 2008 at 3:34 PM, Adam <pu...@gmail.com> wrote:
> Hey all,
>
> I have a project that is creating a signed JAR off of a JAR built with
> dependencies.  Up until recently (for the last year at least) it has
> worked fine with my configuration.  All of a sudden it will not build
> on Windows (but is fine on Linux).  The error I am getting is:
>
> [INFO] jarsigner: unable to sign jar: java.util.zip.ZipException:
> duplicate entry: com/mobilvox/../../applet/...Applet.class
> [INFO] ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO] ------------------------------------------------------------------------
> [INFO] Result of cmd.exe /X /C '""C:\Program
> Files\Java\jdk1.6.0_02\jre\..\bin\jarsigner.exe" -verbose -storepass
> ****** -keypass ****** -signedjar
> C:\dev\workspace\proj-113\..\..\applet\target\signed\...-1.2-SNAPSHOT.jar
> C:\dev\workspace\proj-113\...\...target...-1.2-SNAPSHOT-jar-with-dependencies.jar
> MobilVox"' execution is: '1'.
>
>
> When I look at the JAR I do actually have 2 of the .class files but,
> the only places they exist are in the JAR in the build output
> directory and the other is in buildOutputDirectory/classes
>
> My environment:
>
> Windows XP SP2
> Maven 2.0.8
> Java 1.6.0_2
>
>
> Also, here is the pom configuration:
>
>        <build>
>                <plugins>
>                        <plugin>
>                                <artifactId>maven-assembly-plugin</artifactId>
>                                <configuration>
>                                        <descriptorRefs>
>                                                <descriptorRef>jar-with-dependencies</descriptorRef>
>                                        </descriptorRefs>
>                                </configuration>
>                                <executions>
>                                        <execution>
>                                                <id>make-assembly</id>
>                                                <phase>package</phase>
>                                                <goals>
>                                                        <goal>attached</goal>
>                                                </goals>
>                                        </execution>
>                                </executions>
>                        </plugin>
>                        <plugin>
>                                <artifactId>maven-jar-plugin</artifactId>
>                                <configuration>
>                                        <alias>...</alias>
>                                        <keypass>...</keypass>
>                                        <storepass>...</storepass>
>                                        <jarPath>
>                                                ${project.build.directory}/${project.build.finalName}-jar-with-dependencies.${project.packaging}
>                                        </jarPath>
>                                        <signedjar>
>                                                ${project.build.directory}/signed/${project.build.finalName}.jar
>                                        </signedjar>
>                                        <verify>true</verify>
>                                        <verbose>true</verbose>
>                                        <certs>true</certs>
>                                </configuration>
>                                <executions>
>                                        <execution>
>                                                <goals>
>                                                        <goal>sign</goal>
>                                                </goals>
>                                        </execution>
>                                </executions>
>                        </plugin>
>                </plugins>
>        </build>
>
>  Again, this works fine in Linux and worked for the last year up until
> recently.
>
> Thanks in advance,
>
> Adam Altemus
> MobilVox, Inc
> http://www.mobilvox.com
>



-- 
Adam

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