You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Harald Entner (JIRA)" <ji...@codehaus.org> on 2009/10/22 18:24:26 UTC

[jira] Created: (MANTRUN-121) Difference between Ant and Maven Antrun plugin

Difference between Ant and Maven Antrun plugin
----------------------------------------------

                 Key: MANTRUN-121
                 URL: http://jira.codehaus.org/browse/MANTRUN-121
             Project: Maven 2.x Antrun Plugin
          Issue Type: Bug
    Affects Versions: 1.3
         Environment: Redhat Enterprise Linux 5, Windows XP
            Reporter: Harald Entner
         Attachments: bugreport.zip

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]
{code:title=build1}
<project name="Bugreport" default="test" basedir=".">
  <target name="test">
    <echo>${property}</echo>
    <ant target="test_property" inheritall="false" antfile="sub/build.xml"/>
  </target>
</project>
{code}

{code:title=build2}
<project name="Sub" default="test" basedir=".">
  <target name="test_property" >
    <echo>${property}</echo>
  </target>
</project>
{code}

{code:title=pom.xml}
<?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>
{code}

 [2] The result when invoking

{code:title=Result}
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>

{code}







-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MANTRUN-121) Difference between Ant and Maven Antrun plugin

Posted by "Harald Entner (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MANTRUN-121?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=195597#action_195597 ] 

Harald Entner commented on MANTRUN-121:
---------------------------------------

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

> Difference between Ant and Maven Antrun plugin
> ----------------------------------------------
>
>                 Key: MANTRUN-121
>                 URL: http://jira.codehaus.org/browse/MANTRUN-121
>             Project: Maven 2.x Antrun Plugin
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: Redhat Enterprise Linux 5, Windows XP
>            Reporter: Harald Entner
>         Attachments: bugreport.zip
>
>
> 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]
> {code:title=build1}
> <project name="Bugreport" default="test" basedir=".">
>   <target name="test">
>     <echo>${property}</echo>
>     <ant target="test_property" inheritall="false" antfile="sub/build.xml"/>
>   </target>
> </project>
> {code}
> {code:title=build2}
> <project name="Sub" default="test" basedir=".">
>   <target name="test_property" >
>     <echo>${property}</echo>
>   </target>
> </project>
> {code}
> {code:title=pom.xml}
> <?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>
> {code}
>  [2] The result when invoking
> {code:title=Result}
> 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>
> {code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (MANTRUN-121) Difference between Ant and Maven Antrun plugin

Posted by "Paul Gier (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MANTRUN-121?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Gier closed MANTRUN-121.
-----------------------------

    Resolution: Not A Bug
      Assignee: Paul Gier

The two things that you are comparing are not the same, and that's what causes the difference.  A property defined on the command line in Ant is passed to all the projects regardless of whether you set inheritall to false.

Instead the comparison should replace the pom with an Ant build that contains the same tasks.
pom.xml -> build1 -> build2
build0.xml -> build1 -> build2

If you set the property in build0.xml, then you will see the same behaviour as the maven antrun plugin.

> Difference between Ant and Maven Antrun plugin
> ----------------------------------------------
>
>                 Key: MANTRUN-121
>                 URL: http://jira.codehaus.org/browse/MANTRUN-121
>             Project: Maven 2.x Antrun Plugin
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: Redhat Enterprise Linux 5, Windows XP
>            Reporter: Harald Entner
>            Assignee: Paul Gier
>         Attachments: bugreport.zip
>
>
> 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]
> {code:title=build1}
> <project name="Bugreport" default="test" basedir=".">
>   <target name="test">
>     <echo>${property}</echo>
>     <ant target="test_property" inheritall="false" antfile="sub/build.xml"/>
>   </target>
> </project>
> {code}
> {code:title=build2}
> <project name="Sub" default="test" basedir=".">
>   <target name="test_property" >
>     <echo>${property}</echo>
>   </target>
> </project>
> {code}
> {code:title=pom.xml}
> <?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>
> {code}
>  [2] The result when invoking
> {code:title=Result}
> 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>
> {code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira