File: copyArchetype.xml

package info (click to toggle)
maven-hpi-plugin 1.93-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 592 kB
  • ctags: 421
  • sloc: java: 2,319; xml: 698; makefile: 8
file content (53 lines) | stat: -rw-r--r-- 1,835 bytes parent folder | download
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="&lt;!-- \$$ --&gt;&lt;([^&gt;]+)&gt;.+&lt;!-- /\$$ --&gt;" replace="&lt;\1&gt;$$\{\1\}&lt;/\1&gt;" flags="g" />
      </filterchain>
      <filterchain refid="artifactId" />
    </copy>

    <!-- inject the package statement into *.java files -->
    <echo message="package $${package};&#xA;" 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>