You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Pete <pe...@gmail.com> on 2005/11/24 14:33:43 UTC

[M2] AntRun plugin executing a goal not bound to a phase ?

I'm sure this is a very basic question about using antRun plugin, all
works fine if I
bind the plugin to a phase e.g.

<phase>generate-sources</phase>

but how can I define the plugin to be executed on demand like a
Utility goal to update the Database.

I have tried removing the phase and then command :-

mvn antrun:run

but I get
    task-segment: [antrun:run]
 ----------------------------------------
 [antrun:run]
 Executing tasks
 Executed tasks
 ----------------------------------------

I want a antRun plugin that will be executed during 'integration'
phase, but also defined a second time such that it can be invoked on
its own at will - via a new goal


	<build>
		<plugins>
			<plugin>
				<artifactId>maven-antrun-plugin</artifactId>
				<executions>
					<execution>
						<id>update-db</id>
						<phase>generate-sources</phase>
						<configuration>
							<tasks>
								<ant antfile="build.xml" dir="ant" target="update-oracle-db"
inheritRefs="true"/>
							</tasks>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

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


Re: [M2] AntRun plugin executing a goal not bound to a phase ?

Posted by Brett Porter <br...@gmail.com>.
This isn't actually possible with the plugin, unless perhaps you do this:
- put everything in a top level configuration of the plugin
- pass in a variable from the command line, eg -Dtarget=foo antrun:run
- execute the appropriate target in the script based on the variable

Ideally, you would write a plugin for these goals (Ant support for
plugins will be available soon, currently you must write them in java
or beanshell).

- Brett

On 11/25/05, Pete <pe...@gmail.com> wrote:
> I'm sure this is a very basic question about using antRun plugin, all
> works fine if I
> bind the plugin to a phase e.g.
>
> <phase>generate-sources</phase>
>
> but how can I define the plugin to be executed on demand like a
> Utility goal to update the Database.
>
> I have tried removing the phase and then command :-
>
> mvn antrun:run
>
> but I get
>     task-segment: [antrun:run]
>  ----------------------------------------
>  [antrun:run]
>  Executing tasks
>  Executed tasks
>  ----------------------------------------
>
> I want a antRun plugin that will be executed during 'integration'
> phase, but also defined a second time such that it can be invoked on
> its own at will - via a new goal
>
>
>         <build>
>                 <plugins>
>                         <plugin>
>                                 <artifactId>maven-antrun-plugin</artifactId>
>                                 <executions>
>                                         <execution>
>                                                 <id>update-db</id>
>                                                 <phase>generate-sources</phase>
>                                                 <configuration>
>                                                         <tasks>
>                                                                 <ant antfile="build.xml" dir="ant" target="update-oracle-db"
> inheritRefs="true"/>
>                                                         </tasks>
>                                                 </configuration>
>                                                 <goals>
>                                                         <goal>run</goal>
>                                                 </goals>
>                                         </execution>
>                                 </executions>
>                         </plugin>
>                 </plugins>
>         </build>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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