새 프로젝트 용 ear 파일을 만들기 위해 Maven EAR 플러그인을 사용하고 있습니다. 플러그인 문서에서 모듈에 대한 exclude 문을 지정할 수 있음을 알았습니다. 예를 들어 다음과 같이 내 플러그인에 대한 구성은Maven-ear-plugin - 여러 모듈, 즉 jar, war 등을 제외합니다.
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<jboss>
<version>5</version>
</jboss>
<modules>
<!-- Include the templatecontroller.jar inside the ear -->
<jarModule>
<groupId>com.kewill.kdm</groupId>
<artifactId>templatecontroller</artifactId>
<bundleFileName>templatecontroller.jar</bundleFileName>
<includeInApplicationXml>true</includeInApplicationXml>
</jarModule>
<!-- Exclude the following classes from the ear -->
<jarModule>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<excluded>true</excluded>
</jarModule>
<jarModule>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<excluded>true</excluded>
</jarModule>
... declare multiple excludes
<security>
<security-role id="SecurityRole_1234">
<role-name>admin</role-name>
</security-role>
</security>
</configuration>
</plugin>
</plugins>
이 방법을 사용하면 4-5 모듈을 제외 할 말을 가지고 작은 프로젝트를 절대적으로 괜찮 ...입니다. 그러나, 내 프로젝트에서 나는 30 +가 있고 우리는 방금 프로젝트를 시작했습니다. 그래서 확장되어 확장 될 것입니다.
모듈마다 exclude 문을 명시 적으로 선언하는 것 외에 와일드 카드를 사용하거나 다른 모든 것을 선언하고 제외하는 모듈 만 포함하도록 모든 maven 종속성 플래그를 제외 할 수 있습니까? 누구든지 좀 더 우아한 해결책을 알고 있습니까?
BTW, 사과, 그것은 절대적으로 전형적인 Stackoverflow이야, 당신은 특정 질문을하고 누군가가 일종의/일종 관련 답변을 게시하지만 그것은 변함없이 더 많은 작업이 필요합니다! –
또한, 사용자 정의 mojo에 대한 예제 코드가 약간 있습니다. out-of-the-box 설정을 제공하는 다른 대답을 얻지 못하면 –
하기 전에 모조를 작성했습니다. 왜냐하면 평소와 같이 마감 시간이 너무 짧기 때문입니다.) 어쨌든 플러그인은 와일드 카드 또는 다른 모듈의 완전한 배제를 허용하기에 충분하지 않을 수도 있습니다. 대부분 내가 결국 플러그인을 직접 작성해야 할 것 같다. 당분간 필자는 필요한 모듈을 수동으로 제외 할 것입니다. 감사. –