Show m2.xml syntax highlighted
<project name="m2" basedir="." default="init-m2"
xmlns:m="http://smartfrog.org/macro">
<description>
This is an import library that runs
checkstyle.
</description>
<!-- import the core -->
<import file="core.xml"/>
<target name="m2-published" depends="m2-install" />
<target name="ready-to-publish-m2-artifacts" depends="m2-install,m2-pom" />
<!-- ========================================================== -->
<!-- init all the maven2 support -->
<!-- ========================================================== -->
<target name="init-m2"
depends="init-core,artifact-names">
<!-- Maven2 stuff
All components build into the org.smartfrog group, unless otherwise stated, but
are their own artifacts.
-->
<property name="m2.repository" location="${user.home}/.m2/repository"/>
<property name="m2.publish.repository" location="${core.dir}/build/m2/repository"/>
<mkdir dir="${m2.publish.repository}"/>
<!-- make the root path of an artifact -->
<macrodef name="m2-makepath">
<attribute name="property"/>
<attribute name="groupIDpath"/>
<attribute name="artifactID" default="@{groupIDpath}"/>
<attribute name="classifier" default=""/>
<attribute name="version"/>
<sequential>
<property name="@{property}"
location="${m2.publish.repository}/@{groupIDpath}/@{artifactID}/@{version}"/>
</sequential>
</macrodef>
<property name="m2.artifact.name" value="${artifact.name}"/>
<property name="m2.groupID" value="org.smartfrog"/>
<property name="m2.groupID.path" value="org/smartfrog"/>
<m2-makepath property="m2.subdir"
groupIDpath="${m2.groupID.path}"
artifactID="${m2.artifact.name}"
version="${artifact.version}"/>
<!-- pom setup -->
<property name="target.pom" location="${dist.lib.dir}/${m2.artifact.name}.pom"/>
<property name="project.pom" location="project-template.pom"/>
<property name="target.pom.md5"
location="${target.pom}.md5"/>
<property name="target.jar.md5"
location="${target.jar}.md5"/>
<available property="project.haspom" file="${project.pom}"/>
<makeurl file="${user.home}/.maven/repository/"
property="m1.repository.url"/>
<property name="m2.ibiblio.repository"
value="http://ibiblio.org/maven2"/>
<property name="m1.apache.cvs.repository"
value="http://cvs.apache.org/repository/"/>
</target>
<!-- ========================================================== -->
<!-- POM creation/copy, depending on whether it exists or not -->
<!-- ========================================================== -->
<target name="m2-copy-pom" depends="init-m2" if="project.haspom">
<copy file="${project.pom}" tofile="${target.pom}">
<!-- we expand ant properties here. -->
<filterchain>
<expandproperties/>
</filterchain>
</copy>
</target>
<target name="m2-pom-macros" depends="init-m2">
<macrodef name="m2-makepom" uri="http://smartfrog.org/macro">
<attribute name="artifact"/>
<attribute name="target"/>
<attribute name="version" default="${artifact.version}"/>
<sequential>
<echo message="Creating Pom @{target}" level="verbose"/>
<echo file="@{target}"><![CDATA[<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd
>
<!--
${pom.comments}
-->
<modelVersion>4.0.0</modelVersion>
<groupId>${m2.groupID}</groupId>
<artifactId>@{artifact}</artifactId>
<packaging>jar</packaging>
<version>${smartfrog.version}</version>
</project>
]]></echo>
</sequential>
</macrodef>
<!--make a pom that depends upon smartfrog-->
<macrodef name="m2-makesfpom" uri="http://smartfrog.org/macro">
<attribute name="artifact"/>
<attribute name="org" default="org.smartfrog"/>
<attribute name="target"/>
<attribute name="version" default="${artifact.version}"/>
<attribute name="smartfrog.version" default="${smartfrog.version}"/>
<sequential>
<echo message="Creating Pom @{target}" level="verbose"/>
<echo file="@{target}"><![CDATA[<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd
>
<!--
${pom.comments}
-->
<modelVersion>4.0.0</modelVersion>
<groupId>@{org}</groupId>
<artifactId>@{artifact}</artifactId>
<packaging>jar</packaging>
<version>@{version}</version>
<dependencies>
<dependency>
<groupId>org.smartfrog</groupId>
<artifactId>smartfrog</artifactId>
<version>@{smartfrog.version}</version>
</dependency>
</dependencies>
</project>
]]></echo>
</sequential>
</macrodef>
</target>
<!-- inline creation of a very minimal (zero dependency) pom -->
<target name="m2-make-pom" depends="m2-pom-macros" unless="project.haspom">
<m:makesfpom
artifact="${m2.artifact.name}"
target="${target.pom}"
/>
</target>
<target name="m2-pom" depends="m2-copy-pom,m2-make-pom"/>
<!-- ========================================================== -->
<!-- this is not normally for overriding -->
<!-- install the jar, to the local maven2 repository -->
<!-- ========================================================== -->
<target name="m2-install" depends="packaged,m2-pom"
description="copy the JAR file local maven repository">
<checksum file="${target.jar}" algorithm="md5"/>
<checksum file="${target.pom}" algorithm="md5"/>
<mkdir dir="${m2.subdir}"/>
<copy file="${target.jar}" todir="${m2.subdir}"/>
<!-- copy a pom -->
<copy file="${target.pom}" todir="${m2.subdir}" failonerror="false"/>
<!--copy the checksums-->
<copy file="${target.pom.md5}" todir="${m2.subdir}" failonerror="false"/>
<copy file="${target.jar.md5}" todir="${m2.subdir}" failonerror="false"/>
</target>
</project>
See more files for this project here