forked from jenkinsci/maven-hpi-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
copyArchetype.xml
53 lines (47 loc) · 1.79 KB
/
copyArchetype.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<project name="copy.archetype" default="make.transforming.copy">
<!-- copy hpi-archetypes as resources, while performing necessary transformations for an archetype. -->
<target name="make.transforming.copy">
<property name="src" location="hpi-archetype" />
<property name="dst" location="target/classes/archetype-resources" />
<property name="package.header.file" location="${dst}/.package.header" />
<delete dir="${dst}" />
<mkdir dir="${dst}" />
<!-- this filter chain is applied to all files -->
<filterchain id="artifactId">
<replacestring from="hpi-archetype" to="@artifactId@" />
</filterchain>
<!-- modify POM -->
<copy todir="${dst}">
<fileset dir="${src}">
<include name="pom.xml" />
</fileset>
<filterchain>
<replaceregex pattern="<!-- \$$ --><([^>]+)>.+<!-- /\$$ -->" replace="<\1>$$\{\1\}</\1>" flags="g" />
</filterchain>
<filterchain refid="artifactId" />
</copy>
<!-- inject the package statement into *.java files -->
<echo message="package $${package};
" file="${package.header.file}" />
<copy todir="${dst}">
<fileset dir="${src}">
<include name="**/*.java" />
</fileset>
<filterchain>
<concatfilter prepend="${package.header.file}" />
</filterchain>
<filterchain refid="artifactId" />
</copy>
<delete file="${package.header.file}" />
<!-- process the remaining files -->
<copy todir="${dst}">
<fileset dir="${src}">
<exclude name="pom.xml" />
<exclude name="**/*.java" />
<exclude name="**/.svn" />
<exclude name="target" />
<exclude name="hpi-archetype.*" />
</fileset>
<filterchain refid="artifactId" />
</copy>
</target>
</project>