summaryrefslogtreecommitdiffstats
path: root/make/maven-common.xml
blob: 57c31e8b008fc9598fa23713db3abc30aea48673 (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?xml version="1.0" encoding="UTF-8"?>

<!-- reuseable maven related targets -->
<project name="maven-common" basedir=".">

    <target name="maven.prepare.pom">
        <copy file="pom-template.xml" tofile="${build}/pom-${artifactId}.xml" overwrite="true">
            <filterset>
                <filter token="ARTIFACTID" value="${artifactId}"/>
                <filter token="VERSION" value="${maven.artifacts.version}"/>
                <filter token="DESCRIPTION" value="${description}"/>
                <filter token="DEPENDENCIES" value=""/>
            </filterset>
        </copy>
    </target>

    <target name="maven.prepare.native.pom">
        <loadfile srcfile="pom-rt-dependency.xml" property="maven.dependencies.section"/>
        <copy file="pom-template.xml" tofile="${build}/pom-${artifactId}-${os.and.arch}.xml" overwrite="true">
            <filterchain description="Put in the dependencies section, then replace tokens">
                <replacetokens>
                    <token key="DEPENDENCIES" value="${maven.dependencies.section}"/>
                </replacetokens>
                <replacetokens>
                    <token key="ARTIFACTID" value="${artifactId}"/>
                    <token key="VERSION" value="${maven.artifacts.version}"/>
                    <token key="DESCRIPTION" value="${description}"/>
                </replacetokens>
            </filterchain>
        </copy>
    </target>
    
    <target name="maven.install.artifact">
        <antcall target="maven.prepare.pom" inheritall="true"/>
        <exec executable="mvn" dir="${build}">
            <arg value="install:install-file"/>
            <arg value="-Dfile=${artifactId}.jar"/>
            <arg value="-DpomFile=pom-${artifactId}.xml"/>
            <arg value="-DcreateChecksum=true"/>
        </exec>
    </target>

    <target name="maven.install.native.artifact">
        <antcall target="maven.prepare.native.pom" inheritall="true"/>
        <exec executable="mvn" dir="${build}">
            <arg value="install:install-file"/>
            <arg value="-Dfile=${artifactId}-${os.and.arch}.jar"/>
            <arg value="-DpomFile=pom-${artifactId}-${os.and.arch}.xml"/>
            <arg value="-DcreateChecksum=true"/>
            <arg value="-Dclassifier=${os.and.arch}"/>
        </exec>
    </target>

    <target name="maven.deploy.artifact">
        <antcall target="maven.prepare.pom" inheritall="true"/>
        <exec executable="mvn" dir="${build}">
            <arg value="deploy:deploy-file"/>
            <arg value="-DrepositoryId=sonatype-nexus-snapshots"/>
            <arg value="-Durl=https://oss.sonatype.org/content/repositories/snapshots/"/>

            <arg value="-Dfile=${artifactId}.jar"/>
            <arg value="-DpomFile=pom-${artifactId}.xml"/>
            <arg value="-DcreateChecksum=true"/>
        </exec>
    </target>

    <target name="maven.deploy.native.artifact">
        <antcall target="maven.prepare.native.pom" inheritall="true"/>
        <exec executable="mvn" dir="${build}">
            <arg value="deploy:deploy-file"/>
            <arg value="-DrepositoryId=sonatype-nexus-snapshots"/>
            <arg value="-Durl=https://oss.sonatype.org/content/repositories/snapshots/"/>

            <arg value="-Dfile=${artifactId}-${os.and.arch}.jar"/>
            <arg value="-DpomFile=pom-${artifactId}-${os.and.arch}.xml"/>
            <arg value="-DcreateChecksum=true"/>
            <arg value="-Dclassifier=${os.and.arch}"/>
        </exec>
    </target>

</project>