2014-07-17 3 views
1

jar signer plugin에 문제가 있습니다.Maven jar signer plugin

저는 애플릿을 사용하는 레거시 프로젝트에서 모든 애플릿 jar에 서명해야합니다.

우선 애플릿 프로젝트마다 jar-signer 플러그인을 추가했습니다.

하지만 공통 모듈을 애플릿에 추가해야하므로이 프로젝트에 jarsigner 플러그인을 추가해야합니다.

내가 SRC에 항아리를 체결 복사 내 웹 프로젝트에서 작업 받는다는 - 종속성 플러그인이/주/웹 애플리케이션/애플릿

하지만 난 프로젝트를 compil 때이 오류가 얻을 :

java.lang.SecurityException: class X signer information does not match signer information of other classes in the same package. 

나는 그것이 내 공통 프로젝트 (지금 서명 됨)에서 일부 인터페이스가 있고 내 webproject (서명되지 않음)에 구현이 있기 때문에 생각합니다!

나는 webproject에 서명하고 싶지 않습니다. 이 디렉토리에

<plugin> 
      <artifactId>maven-jarsigner-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>sign</id> 
        <goals> 
         <goal>sign</goal> 
        </goals> 
       </execution> 
      </executions> 
      <configuration> 
       <archiveDirectory>${basedir}/src\main\webapp\applet</archiveDirectory> 
       <includes> 
         <include>**/*.jar</include> 
       </includes> 
       <excludes> 
         <exclude>**/*.war</exclude> 
       </excludes>  
       <keystore>${basedir}/src/main/resources/mykeystore.jks</keystore> 
       <alias>myalias</alias> 
       <storepass>mypassword</storepass> 
       <keypass>mypassword</keypass> 
      </configuration> 
     </plugin>   

:

그래서 나는 모든 프로젝트의 모든 항아리 - 서명자를 제거하고에만이 같은 웹 프로젝트에 항아리 - 서명자 플러그인을 추가하기로 결정 ${basedir}/src\main\webapp\applet 내가 8 개 항아리와 플러그인 기호 9jars이 우리가 볼 수 있듯이 :

[INFO] Webapp assembled in [5206 msecs] 
[INFO] Building war: d:\MarcoPolo\SVN\CASTOR_trunk\CTR_WEB\web\target\ctrweb-02.01.00.war 
[INFO] [jarsigner:sign {execution: sign}] 
[INFO] 9 archive(s) processed 
[INFO] [jar:jar {execution: create-classes}] 
[INFO] Building jar: d:\MarcoPolo\SVN\CASTOR_trunk\CTR_WEB\web\target\ctrweb-02.01.00-classes.jar 
[INFO] [install:install {execution: default-install}] 
[INFO] Installing d:\MarcoPolo\SVN\CASTOR_trunk\CTR_WEB\web\target\ctrweb-02.01.00.war to D:\Users\p 
[INFO] Installing d:\MarcoPolo\SVN\CASTOR_trunk\CTR_WEB\web\target\ctrweb-02.01.00-classes.jar to D: 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESSFUL 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 1 minute 5 seconds 
[INFO] Finished at: Thu Jul 17 11:38:19 CEST 2014 
[INFO] Final Memory: 42M/142M 
[INFO] ------------------------------------------------------------------------ 

나는 ctrweb-02.01.00.war을 열면 모두 서명 된 것을 볼 수 있습니다! 하지만 난 내가

mvn jarsigner:sign 
[INFO] Scanning for projects... 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Castor - Web war 
[INFO] task-segment: [jarsigner:sign] 
[INFO] ------------------------------------------------------------------------ 
[INFO] [jarsigner:sign {execution: default-cli}] 
[INFO] 8 archive(s) processed 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESSFUL 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 3 seconds 
[INFO] Finished at: Thu Jul 17 11:48:52 CEST 2014 
[INFO] Final Memory: 6M/15M 
[INFO] ------------------------------------------------------------------------ 

만 8 개 항아리가 서명을하려고 한 <exclude>**/*.war</exclude>

있습니다.

다른 디렉토리에 jar/war가 아닌 서명 된 애플릿 디렉토리에있는 내 jar 만 갖고 싶습니다.

가능합니까? 의견에 답변

감사

+0

항상 대상 디렉토리에 항아리/전쟁에 서명 :(왜 우리가 원하는 것을 할 수있는 선택을시키지 마라. 누군가 다른 솔루션을 가지고 있다면 ... 감사. –

+1

나는 분류 자, 서명 한 서명과 다른 서명하지 않은 프로젝트로 두 개의 항아리를 만들려고한다. 서명되지 않은 항아리를 가져 와서 복사를 위해 서명 된 항아리를 사용하면 작동해야한다고 생각합니다. –

+1

예! 2 병, 하나는 classifie없이 생성합니다. 다른 하나는 분류 자 ​​(서명)와 함께, jarsigner 플러그인은 태그 아카이브를 사용하여 분류자를 서명 한 jar에만 서명하고 컴파일하는 동안 분류 자없는 jar를 사용하며 분류자를 가진 jar는 애플릿 webapp 디렉토리로 복사합니다. 그래서 내 모든 문제를 해결! –

답변

1

: 내가 플러그인의 주요 목표에 방해가되지 않는 태그를 제외 볼

i try to create two jar from my project with classifier, one signed and the other one not. And during compilation its always took the non-signed jar and for the copy its use the signed-jar, i think it should work – Mançaux Pierre-Alexandre Jul 17 '14 at 12:24

yes its work! i generate 2 jar, one without classifier and another one with classifier (signed), my jarsigner plugin use tag archive to sign only the jar with classifier signed and during compilation, jar without classifier is used, and the jar with the classifier is copy to the applet webapp directory. so i resolve all my problem! – Mançaux Pierre-Alexandre Jul 17 '14 at 14:14

관련 문제