Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Not A Bug
-
Affects Version/s: 1.3
-
Fix Version/s: None
-
Labels:None
-
Environment:Redhat Enterprise Linux 5, Windows XP
-
Number of attachments :
Description
There is a difference between the maven antrun plugin and ant itself, which is a complete show stopper in my case. (actually i invoke ant (via exec) from within maven now!)
The problem occurs when providing a property to the maven-antrun-plugin. There are two build files, build1 and build2. build1 invokes build2, the property is known in build1 but not known in build2. This seems somehow obvious, as inheritall is false .In my case this part of code is generated by netbeans, so i must not change this value, it would work when inheritall is set to true - so maybe this is a bug in ant itself. Still a different behaviour between ant and maven-antrun-plugin.
The code can be seen here [1]
The result (and commands used) can be seen here [2]
[1]
<project name="Bugreport" default="test" basedir="."> <target name="test"> <echo>${property}</echo> <ant target="test_property" inheritall="false" antfile="sub/build.xml"/> </target> </project>
<project name="Sub" default="test" basedir="."> <target name="test_property" > <echo>${property}</echo> </target> </project>
<?xml version="1.0" encoding="UTF-8"?> <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"> <modelVersion>4.0.0</modelVersion> <groupId>at.test</groupId> <artifactId>bugreport</artifactId> <packaging>pom</packaging> <version>1.0-SNAPSHOT</version> <name>Bugreport - difference between ant and maven-ant-run-plugin</name> <build> <plugins> <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>ant-magic</id> <phase>prepare-package</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <property name="property" value="test"/> <ant antfile="${basedir}/build.xml"/> </tasks> </configuration> </execution> </executions> </plugin> </plugins> </build> </project>
[2] The result when invoking
C:\dev\test\bugreport>ant -Dproperty=test
Buildfile: build.xml
test:
[echo] test
test_property:
[echo] test
BUILD SUCCESSFUL
Total time: 0 seconds
C:\dev\test\bugreport>mvn install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Bugreport - difference between ant and maven-ant-run-plugin
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [antrun:run {execution: ant-magic}]
[INFO] Executing tasks
test:
[echo] test
test_property:
[echo] ${property}
[INFO] Executed tasks
[INFO] [site:attach-descriptor {execution: default-attach-descriptor}]
[INFO] [install:install {execution: default-install}]
[INFO] Installing C:\dev\test\bugreport\pom.xml to C:\Dokumente und Einstellungen\HEN\.m2\repository\at\test\b
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Thu Oct 22 18:01:10 CEST 2009
[INFO] Final Memory: 9M/508M
[INFO] ------------------------------------------------------------------------
C:\dev\test\bugreport>
Ant:
Apache Ant version 1.7.1 compiled on June 27 2008
maven-antrun-plugin:
[DEBUG] Plugin dependencies for:
org.apache.maven.plugins:maven-antrun-plugin:1.3
are:
org.apache.maven:maven-plugin-api:jar:2.0.4:runtime
org.apache.maven:maven-project:jar:2.0.4:runtime
org.apache.maven:maven-artifact:jar:2.0.4:runtime
org.codehaus.plexus:plexus-utils:jar:1.5.6:runtime
org.apache.ant:ant-launcher:jar:1.7.1:runtime
org.apache.ant:ant:jar:1.7.1:runtime