You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Vishal Pahwa <vp...@sapient.com> on 2007/11/14 17:08:25 UTC

Exec-maven-plugin usage


Hi

I need to run a java program from maven. For that m gonna use
exec-maven-plugin.  But don't know how to use this. Is it possible that
I will create one new project with folder structure
src/main/java/com/sky/Main.java. N then use plugin like this 

  <build> 
<plugins> 
<plugin> 
<groupId>org.codehaus.mojo</groupId> 
<artifactId>exec-maven-plugin</artifactId> 
<executions> <execution>
 ... <goals> 
<goal>java</goal> 
</goals> 
</execution>
 </executions> 
<configuration>
 <mainClass>com.sky.Main</mainClass>
 <arguments> 
<argument>argument1</argument> 
... </arguments> 
<systemProperties>
 <systemProperty>
 <key>myproperty</key>
 <value>myvalue</value> 
</systemProperty> 
... </configuration> 
</plugin>
 </plugins>
 </build> 

Now if il use mvn:java then this should run the java program. Am I
thinking right or wrong.

Regards
Vishal 


Re: Exec-maven-plugin usage

Posted by Dirk Olmes <di...@xanthippe.ping.de>.
Vishal Pahwa wrote:
> 
> Hi
> 
> I need to run a java program from maven. For that m gonna use
> exec-maven-plugin.  But don't know how to use this. Is it possible that
> I will create one new project with folder structure
> src/main/java/com/sky/Main.java. N then use plugin like this 
> 
>   <build> 
[...]

Looks good. What was the actual question?

Bear in mind that if you want to run classes that are compiled in the
same project, the <goal> you bind to must be after compile in the
lifecylcle, after all the class must have been compiled before you can
use it :-)

-dirk

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