Hi Jacob,

take a look at the following <plugins> section. It definitely works. Note the plugin versions.
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>test</id>
<phase>initialize</phase>
<configuration>
<tasks>
<echo>Hello world!</echo>
<script language="javascript">
                                    x=0;
</script>
<echo>Hello world 2!</echo>
</tasks>
</configuration>
<inherited>false</inherited>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>bsf</groupId>
<artifactId>bsf</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>rhino</groupId>
<artifactId>js</artifactId>
<version>1.7R2</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-apache-bsf</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.7.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>

...

Here, you can see that in ant-1.7.1, for example, you need to have a dependency for ant-nodeps as well as for ant-apache-bsf.

HTH

Armin

Am 11.09.2010 00:54, schrieb Jacob Beard:
Hi Armin,

I believe that that is what the ant-nodeps Maven package is for: ant
with all of the dependencies included into one package. It seems that
if I were able to get this package to install correctly, then the
other problem may be resolved as well.

Do you have any idea as to why a fatal error is being thrown when
ant-nodeps is added to the antrun plugin dependencies, or how to
understand the stack produced by this error?

Please let me know. Thanks,

Jake

On Thu, Sep 9, 2010 at 4:43 AM, Armin Ehrenfels
<[email protected]>  wrote:
Hi Jacob,

  you can see from the error message that an optional ant functionality is
missing. Now, you have to find the ant-xxx.jar that contains this class and
add it to ant-run's dependencies.

HTH

Armin

Am 09.09.2010 05:09, schrieb Jacob Beard:
Hi,

It actually seems that including the Bean Scripting Framework as a
dependency is causing the problems. Consider the following reduced
example. The following succeeds:


  <build>
    <plugins>
       <plugin>
         <artifactId>maven-antrun-plugin</artifactId>
         <version>1.4</version>
         <executions>
           <execution>
        <id>test</id>
             <phase>initialize</phase>
             <configuration>
               <tasks>
                <echo>Hello world!</echo>
                <script language="javascript">
                        x=0;
                </script>
                <echo>Hello world 2!</echo>
               </tasks>
             </configuration>
             <goals>
               <goal>run</goal>
             </goals>
           </execution>
         </executions>
        <dependencies>
                <!--
                <dependency>
                        <groupId>bsf</groupId>
                        <artifactId>bsf</artifactId>
                        <version>2.4.0</version>
                </dependency>
                -->
                <dependency>
                        <groupId>rhino</groupId>
                        <artifactId>js</artifactId>
                        <version>1.7R2</version>
                </dependency>
        </dependencies>
       </plugin>
    </plugins>
  </build>


And produces the following output:


      [echo] Hello world!
      [echo] Hello world 2!


But when the bsf plugin dependency is turned on, the script tag throws
the ClassNotFoundException with ScriptRunner:


  <build>
    <plugins>
       <plugin>
         <artifactId>maven-antrun-plugin</artifactId>
         <version>1.4</version>
         <executions>
           <execution>
        <id>test</id>
             <phase>initialize</phase>
             <configuration>
               <tasks>
                <echo>Hello world!</echo>
                <script language="javascript">
                        x=0;
                </script>
                <echo>Hello world 2!</echo>
               </tasks>
             </configuration>
             <goals>
               <goal>run</goal>
             </goals>
           </execution>
         </executions>
        <dependencies>
                <dependency>
                        <groupId>bsf</groupId>
                        <artifactId>bsf</artifactId>
                        <version>2.4.0</version>
                </dependency>
                <dependency>
                        <groupId>rhino</groupId>
                        <artifactId>js</artifactId>
                        <version>1.7R2</version>
                </dependency>
        </dependencies>
       </plugin>
    </plugins>
  </build>


[INFO] Executing tasks
      [echo] Hello world!
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] An Ant BuildException has occured:
java.lang.ClassNotFoundException:
org.apache.tools.ant.util.optional.ScriptRunner


I tried ant-nodeps as well, but adding that dependency produced a very
unusual error:


[INFO] [antrun:run {execution: test}]
[FATAL ERROR] org.apache.maven.plugin.antrun.AntRunMojo#execute()
caused a linkage error (java.lang.NoSuchMethodError) and may be
out-of-date. Check the realms:
[FATAL ERROR] Plugin realm =
app0.child-container[org.apache.maven.plugins:maven-antrun-plugin:1.4]
urls[0] =
file:/home/jacob/.m2/repository/org/apache/maven/plugins/maven-antrun-plugin/1.4/maven-antrun-plugin-1.4.jar
urls[1] = file:/home/jacob/.m2/repository/rhino/js/1.7R2/js-1.7R2.jar
urls[2] =
file:/home/jacob/.m2/repository/ant/ant-nodeps/1.6.5/ant-nodeps-1.6.5.jar
urls[3] =
file:/home/jacob/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.jar
urls[4] =
file:/home/jacob/.m2/repository/org/apache/ant/ant-nodeps/1.8.1/ant-nodeps-1.8.1.jar
urls[5] =
file:/home/jacob/.m2/repository/org/apache/ant/ant/1.8.1/ant-1.8.1.jar
urls[6] =
file:/home/jacob/.m2/repository/org/apache/ant/ant-launcher/1.8.1/ant-launcher-1.8.1.jar
[FATAL ERROR] Container realm = plexus.core
urls[0] = file:/usr/share/maven2/lib/maven-debian-uber.jar
[INFO]
------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO]
------------------------------------------------------------------------
[INFO]
org.apache.tools.ant.launch.Locator.fromJarURI(Ljava/lang/String;)Ljava/lang/String;
[INFO]
------------------------------------------------------------------------
[INFO] Trace
java.lang.NoSuchMethodError:

org.apache.tools.ant.launch.Locator.fromJarURI(Ljava/lang/String;)Ljava/lang/String;
         at
org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:274)
         at
org.apache.tools.ant.helper.ProjectHelper2.parseUnknownElement(ProjectHelper2.java:130)
         at
org.apache.tools.ant.helper.ProjectHelper2.parseAntlibDescriptor(ProjectHelper2.java:110)
         at
org.apache.tools.ant.taskdefs.Antlib.createAntlib(Antlib.java:91)
         at
org.apache.tools.ant.taskdefs.Definer.loadAntlib(Definer.java:440)
         at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:292)
         at
org.apache.maven.plugin.antrun.AbstractAntMojo.initMavenTasks(AbstractAntMojo.java:346)
         at
org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:201)
         at
org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:81)
         at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
         at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
         at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
         at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
         at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
         at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
         at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
         at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
         at
org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
         at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
         at java.lang.reflect.Method.invoke(Method.java:616)
         at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
         at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
         at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
         at org.codehaus.classworlds.Launcher.main(Launcher.java:375)


Am I missing something? Or would it be best to file a bug report for
the ant-run plugin?

Please let me know. Thanks,

Jake


On Wed, Sep 8, 2010 at 10:59 AM, Jacob Beard<[email protected]>    wrote:

Seems probable. I'll look into it, thanks.

Jake

On Wed, Sep 8, 2010 at 10:48 AM, Wayne Fay<[email protected]>    wrote:

Based on my research, it seems that ScriptRunner support is something
that needs to be built into Ant at compile-time, so perhaps the
version of ant downloaded by maven does not have this support built
into it.

This documentation will probably be useful to you:

http://maven.apache.org/plugins/maven-antrun-plugin/examples/customTasks.html

I assume the Rhino bits are available in ant-nodeps artifact or
similar, but you'd have to ask the Ant crew or figure it out yourself.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to