我想让父POM类似于以下内容:
<project>
<groupId>com.mycompany.whatever</groupId>
<artifactId>whatever-parent</artifactId>
<version>1</version>
<packaging>pom</packaging>
<build>
<plugins>
<!-- plugin for generating resource files -->
<plugin>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>...</version>
<configuration>
<files>
<file>
<!-- location relative to jar's root -->
<location>lorem.txt</location>
<!-- file contents -->
<contents>Lorem ipsum dolor</contents>
</file>
</files>
</configuration>
<executions>
<execution>
<goals>
<goal>...</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
因此,当它将用作父POM时,lorem.txt
文件将自动生成并打包在jar中。
答案 0 :(得分:0)
http://maven.apache.org/plugins-archives/maven-assembly-plugin-2.6/examples/index.html
http://maven.apache.org/plugins/maven-assembly-plugin/
EX:
<assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>bin</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>src/main/config_templates</directory>
<lineEnding>unix</lineEnding>
<outputDirectory>config_templates</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<includes>
<include>dep/*</include>
<include>classpaths/*</include>
<include>endorsed/*</include>
<include>*.jar</include>
</includes>
<outputDirectory>target</outputDirectory>
</fileSet>
https://maven.apache.org/archetype/maven-archetype-plugin/usage.html
我希望他们可以帮助你。