latest question을 본 후 해결책이 될 것 같아요.
모든 ../projectN/generate/pom.xml
은 상위 POM을 부모로 갖고 있지만 특수한 generate-parent
POM을 만들어 모든 단계를 건너 뛰는 것이 좋습니다.
최상위 수준에 generate-parent
라는 별도의 폴더 만들기 :
<modules>
<module>../generate-parent/pom.xml</module> <!-- NEW FOLDER WITH POM -->
<module>../project1/generate/pom.xml</module>
<module>../project1/pom.xml</module>
<module>../project2/generate/pom.xml</module>
<module>../project2/pom.xml</module>
<!-- and many more projects with or without generate sub modules -->
</modules>
이 새로운 치어 평소와 같이 부모 치어를 상속하지만 몇 가지 추가 플러그인 관리를 추가합니다 :
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>your-group</groupId>
<artifactId>your-parent-pom-artifact-id</artifactId>
<version>your-parent-version</version>
</parent>
<artifactId>generate-parent</artifactId>
<packaging>pom</packaging>
<name>${project.artifactId}-${project.version}</name>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<id>default-resources</id>
<phase>none</phase>
</execution>
<execution>
<id>default-testResources</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<executions>
<execution>
<id>default-compile</id>
<phase>none</phase>
</execution>
<execution>
<id>default-testCompile</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<executions>
<execution>
<id>default-test</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<id>default-install</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
을 이제이 pom으로 모든 기본 단계가 비활성화됩니다.
이제이 생성물을 모든 생성 프로젝트에 사용하십시오. 위의 POM은 모두을 부모 POM에 상속하지만 generate-sources
이후 단계를 사용 중지하는 특수 플러그인 관리 파트를 추가합니다.
project1/generate/pom.xml
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>your-group</groupId>
<artifactId>generate-parent</artifactId>
<version>your-parent-version</version>
<relativePath>../../generate-parent</relativePath>
</parent>
...
The rest of your pom
...
</project>
이 효과적으로 당신이 원하는 것을 할 것입니다
의
generate-parent
는이 프로젝트를 생성하기 위해 당신이 원하는 모든 플러그인 관리를 추가하는 중간 사람이다.
질문에 답하는 경우, 나는 그런 식의 방법을 모르고 있습니다. 유일한 제안은 소스 생성을'generate-sources' 단계가 아니라'package','install' 또는'deploy' 단계 (당신이 선호하는 것)에 묶는 것일 수 있습니다. –
정상적인 단계는 괜찮습니다. 대상 단계가 설치되거나 배포 된 경우라도 "생성 모듈"은 라이프 케일 단계 후에 중지해야합니다. 나중의 단계에서 다른 출력물이 필요하지 않습니다. –
발전기 모듈에'pom' 패키징을 지정하는 것은 어떻습니까? 나는 왜 당신이 그것을 분할했는지 궁금해. 나는 코드 genearation을 위해 fornax oaw 플러그인을 사용했던 프로젝트에서 일하고있었습니다. 우리는 단지 자신의 프로파일에서'generate-sources' 단계에 바인딩했습니다. – SpaceTrucker