MPANT-20 : Allow URL substitutions in generated build.xml files.
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@125119 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -67,6 +67,8 @@
|
||||
<property name="javadocdir" value="dist/docs/api"/>
|
||||
<property name="final.name" value="${maven.final.name}"/>
|
||||
|
||||
<property file="build.properties"/>
|
||||
|
||||
<path id="build.classpath">
|
||||
<fileset dir="$${libdir}" >
|
||||
<include name="**/*.jar"/>
|
||||
@@ -355,13 +357,16 @@
|
||||
<j:choose>
|
||||
<j:when test="${checkExist.exists()}">
|
||||
<j:set var="dep" value="${lib.dependency}"/>
|
||||
<!-- note: this is a valid use of artifactDirectory -->
|
||||
<get
|
||||
src="${repo}/${dep.artifactDirectory}/${dep.type}s/${dep.artifact}"
|
||||
dest="$${libdir}/${dep.artifact}"
|
||||
usetimestamp="true"
|
||||
ignoreerrors="true"
|
||||
/>
|
||||
<!-- note: this is a valid use of artifactDirectory -->
|
||||
<j:set var="url" value="${repo}/${dep.artifactDirectory}/${dep.type}s/${dep.artifact}"/>
|
||||
<property name="${dep.artifactId}.jar" value="${url}"/>
|
||||
<j:set var="get.src" value="$${${dep.artifactId}.jar}"/>
|
||||
<get
|
||||
src="${get.src}"
|
||||
dest="$${libdir}/${dep.artifact}"
|
||||
usetimestamp="true"
|
||||
ignoreerrors="true"
|
||||
/>
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<maven:makeRelativePath var="relativePath" basedir="${basedir}" path="${lib.path}" separator="/"/>
|
||||
|
||||
2
ant/src/plugin-test/build.properties
Normal file
2
ant/src/plugin-test/build.properties
Normal file
@@ -0,0 +1,2 @@
|
||||
# Test MPANT-20
|
||||
maven-jaxb-plugin.jar=http://ovh.dl.sourceforge.net/sourceforge/maven-plugins/maven-jaxb-plugin-1.0.jar
|
||||
@@ -15,55 +15,36 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
-->
|
||||
<project xmlns:util="jelly:util"
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:ant="jelly:ant"
|
||||
xmlns:maven="jelly:maven"
|
||||
xmlns:u="jelly:util"
|
||||
xmlns:assert="assert"
|
||||
xmlns:x="jelly:xml">
|
||||
|
||||
<project xmlns:util="jelly:util" xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:maven="jelly:maven" xmlns:u="jelly:util" xmlns:assert="assert" xmlns:x="jelly:xml">
|
||||
<goal name="testPlugin" prereqs="test-ant">
|
||||
<attainGoal name="clean"/>
|
||||
</goal>
|
||||
|
||||
<goal name="test-ant">
|
||||
<attainGoal name="ant"/>
|
||||
|
||||
<assert:assertFileExists file="${basedir}/build.xml"/>
|
||||
|
||||
<ant:property name="noget" value="noget" />
|
||||
<ant:property name="noget" value="noget"/>
|
||||
<ant:ant/>
|
||||
|
||||
<!-- load build.xml file and check that 'target' property is relative -->
|
||||
<u:file name="${basedir}/build.xml" var="buildFile"/>
|
||||
<x:parse var="buildXml" xml="${buildFile.toURL()}" />
|
||||
<x:parse var="buildXml" xml="${buildFile.toURL()}"/>
|
||||
<x:set var="properties" select="$buildXml/project/property"/>
|
||||
<j:set var="defaulttargetdirName" value="${properties[0].attribute('name').value}"/>
|
||||
<j:set var="defaulttargetdirValue" value="${properties[0].attribute('value').value}"/>
|
||||
|
||||
<assert:assertEquals expected="defaulttargetdir" value="${defaulttargetdirName}"
|
||||
msg="first target is not defaulttargetdir"/>
|
||||
<assert:assertEquals expected="target" value="${defaulttargetdirValue}"
|
||||
msg="defaulttargetdir property is not relative"/>
|
||||
|
||||
<!-- check obey jar override -->
|
||||
<assert:assertEquals expected="defaulttargetdir" value="${defaulttargetdirName}" msg="first target is not defaulttargetdir"/>
|
||||
<assert:assertEquals expected="target" value="${defaulttargetdirValue}" msg="defaulttargetdir property is not relative"/>
|
||||
<!-- check obey jar override -->
|
||||
<x:set var="countJarsDownload" select="count($buildXml/project/target[@name = 'get-deps']/get)"/>
|
||||
<assert:assertEquals expected="1" value="${countJarsDownload.intValue().toString()}" msg="Should only download JUnit jar"/>
|
||||
<assert:assertEquals expected="2" value="${countJarsDownload.intValue().toString()}" msg="Should only download JUnit and maven-jaxb-plugin jars"/>
|
||||
<x:set var="countJarsCopy" select="count($buildXml/project/target[@name = 'get-deps']/copy)"/>
|
||||
<assert:assertEquals expected="1" value="${countJarsDownload.intValue().toString()}" msg="Should only copy the activation jar"/>
|
||||
|
||||
<assert:assertEquals expected="1" value="${countJarsCopy.intValue().toString()}" msg="Should only copy the activation jar"/>
|
||||
<!-- check test filesets -->
|
||||
<x:set var="testFilesetDirs" select="$buildXml/project/target[@name = 'compile-tests']/copy/fileset/@dir"/>
|
||||
<assert:assertEquals expected="src/test" value="${testFilesetDirs[0].value}"
|
||||
msg="test fileset dirs are not relative"/>
|
||||
|
||||
<assert:assertEquals expected="src/test" value="${testFilesetDirs[0].value}" msg="test fileset dirs are not relative"/>
|
||||
<assert:assertFileExists file="${maven.build.dest}/directory-1/file1.properties"/>
|
||||
<assert:assertFileExists file="${maven.build.dest}/file2.properties"/>
|
||||
<!-- there are no unit test sources present, so the resources wont be copied either
|
||||
<assert:assertFileExists file="${maven.test.dest}/directory-1/file1.properties"/>
|
||||
<assert:assertFileExists file="${maven.test.dest}/file2.properties"/-->
|
||||
|
||||
<delete file="${basedir}/build.xml"/>
|
||||
</goal>
|
||||
</project>
|
||||
|
||||
@@ -61,7 +61,15 @@
|
||||
<type>jar</type>
|
||||
<properties/>
|
||||
</dependency>
|
||||
|
||||
<!-- Used to test -->
|
||||
<dependency>
|
||||
<groupId>maven-plugins</groupId>
|
||||
<artifactId>maven-jaxb-plugin</artifactId>
|
||||
<version>1.0</version>
|
||||
<type>jar</type>
|
||||
<properties/>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
<release version="1.9" date="">
|
||||
<action dev="epugh" type="add" issue="MPANT-7">Obey jar override and not attempt to download relative jars.</action>
|
||||
<action dev="aheritier" type="add" issue="MPANT-20" due-to="Dennis Lundberg">Allow URL substitutions in generated build.xml files.</action>
|
||||
</release>
|
||||
<release version="1.8.1" date="2004-08-20">
|
||||
<action dev="carlos" type="fix" issue="MPANT-16">Use relative paths in test resources filesets.</action>
|
||||
|
||||
Reference in New Issue
Block a user