On 3/11/07, Jerome Lacoste <[EMAIL PROTECTED]> wrote:
On 3/9/07, Milos Kleint <[EMAIL PROTECTED]> wrote:
> not sure I follow you Jerome, could you write a sample mvn exec:exec
> ..... command line that would do that? I'm having trouble doing the
> equivalent of
> the following pom section on the command line only:


You can add the classpath 'manualy' on the command line, maven will not add
it for you (it has no way of knowing where you want it to be).
> cat > pom.xml << EOF
<?xml version="1.0 "?>
<project>
        <modelVersion>4.0.0</modelVersion>

        <groupId>org.cb.tests</groupId>
        <artifactId>test-exec</artifactId>
        <version> 1.0-SNAPSHOT</version>
</project>
> cat > Test.java << EOF
public class Test {
  public static void main(String[] args) {
    System.out.println(args[0]);
  }
}
EOF
> javac Test.java
> mvn exec:exec -Dexec.executable=$JAVA_HOME/bin/java
-Dexec.args="-classpath . Test Hello_World"
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'exec'.
[INFO]
----------------------------------------------------------------------------
[INFO] Building Unnamed -
org.cb.tests:test-exec:jar:1.0-SNAPSHOT
[INFO]    task-segment: [exec:exec]
[INFO]
----------------------------------------------------------------------------
[INFO] [exec:exec]
[INFO] Hello_World
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Sun Mar 11 07:45:28 CET 2007
[INFO] Final Memory: 2M/53M
[INFO]
------------------------------------------------------------------------


If you can't specify your classpath in the command line, you can probably
retrieve the classpath (in my case '.') using another plugin. I think the
dependency plugin has a feature like that.

If that's not possible, maybe you want to provide a patch to exec:exec so
that something like that works ?

http://jira.codehaus.org/browse/MEXEC-21

Milos




mvn exec:exec -Dexec.executable=$JAVA_HOME/bin/java
-Dexec.classpath_var=EXEC_CP -Dexec.args="-classpath EXEC_CP Test
Hello_World"

Specifying -Dexec.classpath_var would enable the filling in of the specified
argument (EXEC_CP) in exec.args.

Some notes:
- classpath is not specified the same on Windows / Unix /

Cheers,

Jerome


---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to