创建一个多模块项目,其中第一个模块只是将 xml 文件复制到一个 jar 中。第二个模块使用该 jar 作为输入并执行插件。
.
├── pom.xml
├── xml
| ├── pom.xml
| └── 源
| └── 主要
| └── 资源
| └── com
| └── 堆栈溢出
| ├── 包1
| | └── FirstClass.xml
| └── 包2
| └── SecondClass.xml
└── 创
└── pom.xml
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>
<groupId>com.stackoverflow</groupId>
<artifactId>Q12682078</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>${project.artifactId}-${project.version}</name>
<modules>
<module>xml</module>
<module>gen</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.stackoverflow</groupId>
<artifactId>Q12682078-xml</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
xml/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>com.stackoverflow</groupId>
<artifactId>Q12682078</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>Q12682078-xml</artifactId>
<name>${project.artifactId}-${project.version}</name>
</project>
gen/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>com.stackoverflow</groupId>
<artifactId>Q12682078</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>Q12682078-gen</artifactId>
<name>${project.artifactId}-${project.version}</name>
<dependencies>
<dependency>
<groupId>com.stackoverflow</groupId>
<artifactId>Q12682078-xml</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<!-- your plugin that now has the xml files in the classpath -->
</plugin>
</plugins>
</build>
</project>