maven-shade-plugin을 사용하여 두 개의 개별 jar를 하나의 결합 된 jar로 결합합니다.Maven-shade-plugin에 서명을 보존하는 방법은 무엇입니까?
병 중 하나가 서명되고 다른 하나는 서명되지 않습니다.
플러그인의 기본 구성을 사용하는 경우 새 매니페스트에 서명에 필요한 요약이 누락되어 깨진 jar 파일이 생성됩니다.
서명 파일을 제외하여 항아리를 "고칠 수"있지만 서명되지 않은 항아리가 생성됩니다.
나는 모든 서명 된 클래스가 서명되고 유효한 채로 결합 된 병을 만드는 방법을 찾고 있습니다. - jar 형식을 사용하면 이러한 종류의 항아리가 허용되지만 shade 플러그인에 그렇게하도록 쉬운 방법을 찾을 수 없습니다.
매니페스트 파일의 적절한 병합을 수행하기 위해 자체 트랜스포머를 작성해야합니까? 찾지 못했던 그늘 플러그인에 이미 적절한 옵션이 있습니까?
예 : (서명 foo는에 서명 한 바 결합)
:<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mygroup</groupId>
<artifactId>myparent</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>foo</module>
<module>bar</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
foo는/pom.xml 파일 (두 개의 모듈 "foo는"과 "바"정의)
의 pom.xml
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>mygroup</groupId>
<artifactId>myparent</artifactId>
<version>1.0</version>
</parent>
<artifactId>foo</artifactId>
<dependencies>
<dependency>
<groupId>mygroup</groupId>
<artifactId>bar</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>Foo</Main-Class>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
바/pom.xml 파일 : (서명 줄을 만들 수)
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>mygroup</groupId>
<artifactId>myparent</artifactId>
<version>1.0</version>
</parent>
<artifactId>bar</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<keystore>${user.home}/keystore-name</keystore>
<alias>alias-name</alias>
<storepass>123456</storepass>
</configuration>
<executions>
<execution>
<id>sign</id>
<goals>
<goal>sign</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
두 개의 모듈에 하나의 hello-word 클래스가 포함되어 있으면 java -jar foo/target/foo-1.0.jar
이 작동하고 jarsigner -verify foo/target/foo-1.0.jar
은 서명 된 클래스가 있는지를 알 수 있습니다.