You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Anuerin Diaz (JIRA)" <ji...@codehaus.org> on 2005/11/10 13:49:06 UTC

[jira] Created: (MNG-1490) antrun fails if task åarameters if of type EnumeratedAttributes

antrun fails if task åarameters if of type EnumeratedAttributes
---------------------------------------------------------------

         Key: MNG-1490
         URL: http://jira.codehaus.org/browse/MNG-1490
     Project: Maven 2
        Type: Bug
  Components: maven-antrun-plugin  
    Versions: 2.0    
 Environment: Windows XP Professional/JDK 1.4.2_04
    Reporter: Anuerin Diaz
 Attachments: sample.zip, testbed-src.zip, testbed.zip

  the ant-run plugin (or the launcher) seems unable to properly convert attributes that are of the type EnumeratedAttribute[1]. the execution always fail with an error that the attribute being set is not supported by the class.

  i have attached 3 files to serve as a test case for this.

  1. "sample.zip" - contains the project that will serve as the main test case. it really is just the plugin tutorial and i just added the followign in the pom.xml so my test Task will be called during compile time:

 <build>
   <extensions>
        <extension>
                <groupId>testbed</groupId>
                <artifactId>tests</artifactId>
                <version>1.0</version>
        </extension>
        <extension>
                <groupId>ant</groupId>
                <artifactId>ant</artifactId>
                <version>1.5</version>
        </extension>
   </extensions>
  <plugins>
     <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
           <execution>
              <phase>compile</phase>
                 <configuration>
                    <tasks>
                       <ant
                           target = "test-run"
                           antfile = "${basedir}/build.xml">

                           <property name="paramValue"  value="FirstValue"/>
                        </ant>
                    </tasks>
                 </configuration>
                 <goals>
                    <goal>run</goal>
                  </goals>
            </execution>
         </executions>
      </plugin>
   </plugins>
 </build>

   2. "testbed.zip" - contains the test Ant Task jar file. the test task has one attribute that is derived from EnumeratedAttribute.

   3.  "testbed-src.zip" - contains the source code for the testbed artifact (in case somebody is interested).


   i think the problem is just with the launcher since the task runs fairly well from normal Ant invocation. i found this problem when i was trying to use the <ejbjar/> task in the ant-optional package.

   thanks.

 [1] http://ant.apache.org/manual/develop.html#set-magic



-- 
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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[jira] Closed: (MNG-1490) antrun fails if task åarameters if of type EnumeratedAttributes

Posted by "Kenney Westerhof (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-1490?page=all ]
     
Kenney Westerhof closed MNG-1490:
---------------------------------

    Resolution: Cannot Reproduce

Your pom is wrong.

You need to use the <dependencies> tag within the <plugin> tag.
Then, leave out the dependency on ant since the antrun plugin already has that,
and it might give classcast exceptions on some occasions.

So use this: (btw don't put spaces around '=' in attribute declarations - it's not well-formed XML,
although the Plexus XMLPullParser doesn't seem to care..)

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>sample.plugin</groupId>
  <artifactId>maven-hello-plugin</artifactId>
  <packaging>maven-plugin</packaging>
  <version>1.0</version>
  <name>Sample Parameter-less Maven Plugin</name>
  <dependencies>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-tools-api</artifactId>
      <version>2.0</version>
    </dependency>
  </dependencies>
  <build>
    <plugins>
    <plugin>
      <artifactId>maven-antrun-plugin</artifactId>
    <dependencies>
      <dependency>
        <groupId>testbed</groupId>
        <artifactId>tests</artifactId>
        <version>1.0</version>
      </dependency>
    </dependencies>

      <executions>
        <execution>
          <phase>compile</phase>
          <configuration>
            <tasks>
              <ant
                target = "test-run"
                antfile="${basedir}/build.xml">
                <property name="paramValue"  value="FirstValue"/>
              </ant>
            </tasks>
          </configuration>
          <goals>
            <goal>run</goal>
          </goals>
        </execution>
    </executions>
    </plugin>
  </plugins>
  </build>
</project>


Output I got:

[~/work/sandbox/m2test/antrun-test/sample]                                      
[forge@fire]> m2 test

THE m2 COMMMAND IS DEPRECATED - PLEASE RUN mvn INSTEAD

[INFO] Scanning for projects...
[INFO] -------------------------------------------------------------------------
---
[INFO] Building Sample Parameter-less Maven Plugin
[INFO]    task-segment: [test]
[INFO] -------------------------------------------------------------------------
---
[INFO] [plugin:descriptor]
[INFO] Using 2 extractors.
[INFO] Applying extractor for language: java
[INFO] Extractor for language: java found 1 mojo descriptors.
[INFO] Applying extractor for language: bsh
[INFO] Extractor for language: bsh found 0 mojo descriptors.
[WARNING] POM for: 'commons-io:commons-io:pom:1.0' does not appear to be valid. 
Its will be ignored for artifact resolution.

Reason: Failed to validate POM


[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[WARNING] POM for: 'ant:ant:pom:1.6.5' does not appear to be valid. Its will be ignored for artifact resolution.

Reason: Parse error reading POM


[INFO] [antrun:run {execution: default}]
[INFO] Executing tasks

test-run:
     [echo] Parameter from parent FirstValue
Stored Value: FirstValue
[INFO] Executed tasks
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] No sources to compile
[INFO] [surefire:test]
[INFO] No tests to run.
[INFO] ----------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ----------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Thu Nov 17 18:36:29 CET 2005
[INFO] Final Memory: 4M/9M
[INFO] ----------------------------------------------------------------------------


> antrun fails if task åarameters if of type EnumeratedAttributes
> ---------------------------------------------------------------
>
>          Key: MNG-1490
>          URL: http://jira.codehaus.org/browse/MNG-1490
>      Project: Maven 2
>         Type: Bug
>   Components: maven-antrun-plugin
>     Versions: 2.0
>  Environment: Windows XP Professional/JDK 1.4.2_04
>     Reporter: Anuerin Diaz
>  Attachments: sample.zip, testbed-src.zip, testbed.zip
>
>
>   the ant-run plugin (or the launcher) seems unable to properly convert attributes that are of the type EnumeratedAttribute[1]. the execution always fail with an error that the attribute being set is not supported by the class.
>   i have attached 3 files to serve as a test case for this.
>   1. "sample.zip" - contains the project that will serve as the main test case. it really is just the plugin tutorial and i just added the followign in the pom.xml so my test Task will be called during compile time:
>  <build>
>    <extensions>
>         <extension>
>                 <groupId>testbed</groupId>
>                 <artifactId>tests</artifactId>
>                 <version>1.0</version>
>         </extension>
>         <extension>
>                 <groupId>ant</groupId>
>                 <artifactId>ant</artifactId>
>                 <version>1.5</version>
>         </extension>
>    </extensions>
>   <plugins>
>      <plugin>
>         <artifactId>maven-antrun-plugin</artifactId>
>         <executions>
>            <execution>
>               <phase>compile</phase>
>                  <configuration>
>                     <tasks>
>                        <ant
>                            target = "test-run"
>                            antfile = "${basedir}/build.xml">
>                            <property name="paramValue"  value="FirstValue"/>
>                         </ant>
>                     </tasks>
>                  </configuration>
>                  <goals>
>                     <goal>run</goal>
>                   </goals>
>             </execution>
>          </executions>
>       </plugin>
>    </plugins>
>  </build>
>    2. "testbed.zip" - contains the test Ant Task jar file. the test task has one attribute that is derived from EnumeratedAttribute.
>    3.  "testbed-src.zip" - contains the source code for the testbed artifact (in case somebody is interested).
>    i think the problem is just with the launcher since the task runs fairly well from normal Ant invocation. i found this problem when i was trying to use the <ejbjar/> task in the ant-optional package.
>    thanks.
>  [1] http://ant.apache.org/manual/develop.html#set-magic

-- 
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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org