Unfortunately you can't cherrypick executions from the commandline -
it will run with the plugin level configuration.

You're best bet to achieve this putting the tasks in a separate build
file and then having something like:

<plugin>
  ...
  <configuration>
    <tasks>
      <ant target="${antrun.target}" />
    </tasks>
  </configuration>
  <executions>
    <execution>
      <id>some.target</id>
      <configuration>
        <tasks>
          <ant target="some-target" />
        </tasks>
      </configuration>
      <goals>
        <goal>run</goal>
      </goals>
    </execution>

... and so on

So you can run antrun:run -Dantrun.target=some-target

You can write mojo's in Ant as well which might be a more practical
solution to your problem.

Cheers,
Brett

2008/10/11 Mark Struberg <[EMAIL PROTECTED]>:
> Hi!
>
> I'd like to know what you think about the following problem:
>
> One of my colleagues use the maven-antrun-plugin to execute an ant task which 
> is not available through a native maven plugin (the openjpa-maven-plugin 
> currently only implements the 'enhance' mojo, but no mappingtool support). He 
> was able to link this to the process-classes phase, but now likes is to 
> additionally invoke this step MANUALLY.
>
> This is the antrun plugin config he used:
>
> <plugin>
> <artifactId>maven-antrun-plugin</artifactId>
> <executions>
>  <execution>
>    <id>mappingtool</id>
>    <!-- todo: make this a manual target -->
>    <phase>process-classes</phase>
>    <configuration>
>      <tasks>
>        <java classname="org.apache.openjpa.jdbc.meta.MappingTool"
>              classpathref="maven.runtime.classpath"
>              dir="target/classes" fork="true"
>              args="-action buildSchema -foreignKeys false" />
>      </tasks>
>    </configuration>
>    <goals>
>      <goal>run</goal>
>    </goals>
>  </execution>
> </executions>
> </plugin>
>
>
> While I personally would simply extend the openjpa-maven-plugin to also 
> support the missing tasks (as I did with it's predecessor, the 
> kodo-maven-plugin 
> http://ns1.backwork.net/git/index.php?p=kodo-maven-plugin.git), this is not 
> always an option for everyone (my colleague never wrote a mojo until now).
>
> So, is there a way call something like:
> $> mvn antrun:execute -Dantrun.id=mappingtool
> or kind of?
>
> If not (which I expect from looking at the source), do you also think that 
> there is a need for something?
>
> Plus: is it possible to implement this? All the defined ant tasks are usually 
> bound to a special phase, so if we call the antrun plugin manually
> $> mvn antrun:run
> the maven-antrun-plugin gets no execution information at all, because it has 
> no phase bound to it. Is there a way to get all task-defs even the ones from 
> other phases, so we could iterate over them and grab the one with the right 
> 'id'?
>
> Hope my post isn't too confusing ;)
>
> LieGrue,
> strub
>
> PS: I told him to extract his tasks to a seperate build.xml, so he could call 
> it via ant. But to be honest, having the need to call ant natively doesn't 
> really feel comfortable.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Brett Porter
Blog: http://blogs.exist.com/bporter/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to