동일한 pom 파일에서 두 개의 jar 파일을 만들려고합니다 (예 : this Sonotype blog post은 읽지 않았습니다). 왜냐하면 우리가 모든 자원을 필요로하고 내부적 인 이유없이 하나를 필요로하기 때문입니다. 은이 작동해야한다고 생각하는 구성으로 maven-jar-plugin을 구성했지만 리소스는 항상 포함됩니다. 우리가 만들 때maven-jar-plugin 제외 실패
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>package-consumer</id>
<phase>package</phase>
<configuration>
<classifier>consumer</classifier>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.bmp</exclude>
<exclude>**/*.jpg</exclude>
<exclude>**/*.jpeg</exclude>
<exclude>**/*.gif</exclude>
<exclude>**/*.xml</exclude>
<exclude>**/*.sql</exclude>
<exclude>**/*.log4j</exclude>
<exclude>**/*.properties</exclude>
<exclude>**/*.sh</exclude>
</excludes>
</resource>
</resources>
</configuration>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
, 우리는 OurProject.Jar 및 OurProject - consumer.jar 한 기대로 얻을 수 있지만, 모두 같은 자원을 각 jar 파일에 있습니다 여기에 우리의 POM 파일의 관련 부분이다.
목록이나 특정 확장자 대신 <exclude>**/*</exclude>
과 <exclude>**/resources/*.*</exclude>
을 시도했습니다. 기쁨이 없습니다. 나는 우리가 뭔가를 놓치기를 바라고 있습니다.
감사합니다. 태그를 밖으로 이동하면 문제가 해결됩니다. 우리 항아리가 없으므로 태그 블록의 필요성을 이해하지 못합니다. –
cneff
우리가 만난 또 다른 경고 : 우리가 프리스트 (frist)가 변경을 가했을 때, 소비자 용 병에서 POM 파일을 제외 시켰기 때문에 consuer jar의 내용이 변경되지 않았으므로 다시 작성하지 않았습니다! 말할 필요도없이 두 개의 jar 파일에서 다른 타임 스탬프를 발견 할 때까지 혼란과 좌절감이 생겼습니다. – cneff
두 번째 설정은 파일 확장자 집합에 대해 [필터링] (http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html)을 활성화하는 것입니다 (다른 자원은 변경하지 않고 복사) . 원래 ' true '때문에 필터링이 필요하다고 가정했습니다. pom.xml에 관해서는 다시 원하면 ' **/*. xml '패턴을 다시 생각해 볼 필요가 있습니다. –