summaryrefslogtreecommitdiff
path: root/java/jca/build.xml
blob: 83cc781ba9d4c09d36e07ea7aa2f902bf5d0baa3 (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!--
 -
 - Licensed to the Apache Software Foundation (ASF) under one
 - or more contributor license agreements.  See the NOTICE file
 - distributed with this work for additional information
 - regarding copyright ownership.  The ASF licenses this file
 - to you under the Apache License, Version 2.0 (the
 - "License"); you may not use this file except in compliance
 - with the License.  You may obtain a copy of the License at
 -
 -   http://www.apache.org/licenses/LICENSE-2.0
 -
 - Unless required by applicable law or agreed to in writing,
 - software distributed under the License is distributed on an
 - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 - KIND, either express or implied.  See the License for the
 - specific language governing permissions and limitations
 - under the License.
 -
 -->
<project name="jca" xmlns:artifact="antlib:org.apache.maven.artifact.ant" default="build">

  <property name="module.depends" value="common client"/>
  <property name="module.name" value="jca"/>

  <property name="module.genpom" value="true"/>
  <property name="module.genpom.args" value="-Sgeronimo-j2ee-connector_1.5_spec=provided -Sgeronimo-jta_1.1_spec=provided -Sgeronimo-jms_1.1_spec=provided -Sgeronimo-ejb_3.0_spec=provided -Sgeronimo-servlet_3.0_spec=provided -Sgeronimo-kernel=provided"/>

  <import file="../module.xml"/>

  <property name="rar.name.prefix" value="${project.name}-ra"/>
  <property name="module.rar" value="${build.lib}/${rar.name.prefix}-${project.version}.rar"/>
  <property name="rar.resources" value="rar/src/main/resources"/>
  <property name="rar.scratch.pom" value="${build.scratch}/${rar.name.prefix}-${project.version}.pom"/>


  <target name="rar" depends="jar" description="creates a rar file containing the module jar, client jars, etc">
    <jar destfile="${module.rar}">
      <fileset dir="${rar.resources}">
        <include name="**/*.xml"/>
      </fileset>
      <fileset dir="${build.lib}">
        <include name="${project.name}-jca-${project.version}.jar"/>
        <include name="${project.name}-client-${project.version}.jar"/>
        <include name="${project.name}-common-${project.version}.jar"/>
      </fileset>
    </jar>
  </target>

  <!-- Create properties file for examples -->
  <target name="example-properties-file">
    <copy file="example/build-properties.xml.temp" tofile="example/build-properties.xml" overwrite="true">
      <filterset>
        <filter token="project.version" value="${project.version}"/>
      </filterset>
    </copy>
  </target>

  <!-- Copy jars for standalone examples -->
  <target name="example-jars">
    <mkdir dir="example/lib"/>
    <copy todir="example/lib">
      <fileset dir="${build.lib}">
        <include name="${project.name}-jca-${project.version}.jar"/>
        <include name="${project.name}-client-${project.version}.jar"/>
        <include name="${project.name}-common-${project.version}.jar"/>
      </fileset>
    </copy>
  </target>

  <target name="examples" depends="example-properties-file, example-jars"/>

  <target name="postbuild" depends="rar, examples"/>

  <!-- Override module.xml 'libs' target to avoid copying the jar files dependencies
       into the 'build/lib' dir, since they will be supplied by the app server -->
  <target name="libs"/>

  <!--Overrides, but depends on, [module.]pom target in module.xml -->
  <target name="pom" depends="module.pom" if="module.genpom">
    <jython path="${mllib.dir}">
      <args>
        <arg line='"${project.root}/genpom"'/>
        <arg line='-s "${project.root}/lib/poms"'/>
        <arg line='-o "${rar.scratch.pom}"'/>
        <arg line="-u ${project.url}"/>
        <arg line="-g ${project.groupid}"/>
        <arg line="-v ${project.version.maven}${maven.version.suffix}"/>
        <arg line="-a ${rar.name.prefix}"/>
        <arg line="-t rar"/>
      </args>
    </jython>
  </target>

  <!--Overrides, but depends on, [module.]release-mvn target in module.xml -->
  <target name="release-mvn" depends="module.release-mvn" if="module.genpom" description="Install the artifacts into the local repository and prepare the release artifacts">
    <artifact:pom id="rar.pom" file="${rar.scratch.pom}"/>

    <artifact:install file="${module.rar}" pomRefId="rar.pom" settingsFile="${maven.settings.xml}">
        <localRepository path="${maven.local.repo}"/>
    </artifact:install>

    <artifact:deploy file="${module.rar}" pomRefId="rar.pom" uniqueVersion="${maven.unique.version}" settingsFile="${maven.settings.xml}">
      <localRepository path="${maven.local.repo}"/>
      <remoteRepository url="${maven.remote.repo}"/>
    </artifact:deploy>
  </target>

  <!--Overrides, but depends on, [module.]deploy-snapshot target in module.xml -->
  <target name="deploy-snapshot" depends="module.deploy-snapshot" if="module.genpom" description="deploy a snapshot build to nexus">
    <!-- In order to use this target you need to have predefined a username and password for the
    server with id ${maven.snapshots.repo.id} in your m2 settings file, e.g ~/.m2/settings.xml -->
    <artifact:pom id="rar.pom" file="${rar.scratch.pom}"/>

    <fail message="The pom version must include -SNAPSHOT. Version found was: ${rar.pom.version}">
      <condition>
        <not>
          <contains substring="-SNAPSHOT" string="${rar.pom.version}" />
        </not>
      </condition>
    </fail>

    <artifact:install file="${module.rar}" pomRefId="rar.pom" settingsFile="${maven.settings.xml}">
        <localRepository path="${maven.local.repo}"/>
    </artifact:install>

    <artifact:deploy file="${module.rar}" pomRefId="rar.pom">
      <localRepository path="${maven.local.repo}"/>
      <remoteRepository id="${maven.snapshots.repo.id}" url="${maven.snapshots.repo.url}"/>
    </artifact:deploy>
  </target>

</project>