@@ -54,9 +54,9 @@ attributes.</p> | |||||
<td align="center" valign="top"><b>Required</b></td> | <td align="center" valign="top"><b>Required</b></td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td valign="top">classname</td> | |||||
<td valign="top"><a name="classname">classname</a></td> | |||||
<td valign="top">the Java class to execute.</td> | <td valign="top">the Java class to execute.</td> | ||||
<td align="center" valign="top">Either <tt>jar</tt> or <tt>classname</tt></td> | |||||
<td align="center" valign="top">Either <tt>jar</tt>, <tt>classname</tt> or <tt>module</tt></td> | |||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td valign="top">jar</td> | <td valign="top">jar</td> | ||||
@@ -64,7 +64,7 @@ attributes.</p> | |||||
Main-Class entry in the manifest). Fork must be set to true if this option is selected. | Main-Class entry in the manifest). Fork must be set to true if this option is selected. | ||||
See notes below for more details. | See notes below for more details. | ||||
</td> | </td> | ||||
<td align="center" valign="top">Either <tt>jar</tt> or <tt>classname</tt></td> | |||||
<td align="center" valign="top">Either <tt>jar</tt>, <tt>classname</tt> or <tt>module</tt></td> | |||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td valign="top">args</td> | <td valign="top">args</td> | ||||
@@ -119,6 +119,25 @@ attributes.</p> | |||||
(ignored if fork is disabled)</td> | (ignored if fork is disabled)</td> | ||||
<td align="center" valign="top">No</td> | <td align="center" valign="top">No</td> | ||||
</tr> | </tr> | ||||
<tr> | |||||
<td valign="top">module</td> | |||||
<td valign="top">The initial or main module to resolve. To specify | |||||
the module main class use the <a href="#classname">classname</a> attribute. | |||||
Fork must be set to true if this option is selected.<em>since Ant 1.9.7</em></td> | |||||
<td align="center" valign="top">Either <tt>jar</tt>, <tt>classname</tt> or <tt>module</tt></td> | |||||
</tr> | |||||
<tr> | |||||
<td valign="top">modulepath</td> | |||||
<td valign="top">Specify where to find application modules. A list of directories of modules, module files or exploded modules.<em>since Ant 1.9.7</em></td> | |||||
<td align="center" valign="top">No</td> | |||||
</tr> | |||||
<tr> | |||||
<td valign="top">modulepathref</td> | |||||
<td valign="top">The modulepath to use, given as <a | |||||
href="../using.html#references">reference</a> to a PATH defined elsewhere. | |||||
<em>since Ant 1.9.7</em></td> | |||||
<td align="center" valign="top">No</td> | |||||
</tr> | |||||
<tr> | <tr> | ||||
<td valign="top">failonerror</td> | <td valign="top">failonerror</td> | ||||
<td valign="top">Stop the buildprocess if the command exits with a | <td valign="top">Stop the buildprocess if the command exits with a | ||||
@@ -312,6 +331,18 @@ error and would mean the build exits. | |||||
, then <code><java></code> <b>must</b> return 0 otherwise the build will | , then <code><java></code> <b>must</b> return 0 otherwise the build will | ||||
exit, as the class was run by the build JVM.</p> | exit, as the class was run by the build JVM.</p> | ||||
<a name="modulepath"><h4>modulepath</h4> | |||||
<i><b>Since Ant 1.9.7</b></i> | |||||
<p><code>Java</code>'s <i>modulepath</i> attribute is a <a | |||||
href="../using.html#path">PATH like structure</a> and can also be set via a nested | |||||
<i>modulepath</i> element.</p> | |||||
<a name="upgrademodulepath"><h4>upgrademodulepath</h4> | |||||
<i><b>Since Ant 1.9.7</b></i> | |||||
<p>The location of modules that replace upgradeable modules in the runtime image | |||||
can be specified using this <a href="../using.html#path">PATH like structure</a>.</p> | |||||
<h3>JAR file execution</h3> | <h3>JAR file execution</h3> | ||||
<p>The parameter of the <tt>jar</tt> attribute is of type <tt>File</tt>; | <p>The parameter of the <tt>jar</tt> attribute is of type <tt>File</tt>; | ||||
@@ -400,6 +431,31 @@ log-prefix to <code>[java1.4]</code>. | |||||
JVM, as it takes different parameters for other JVMs, | JVM, as it takes different parameters for other JVMs, | ||||
That JVM can be started from <code><exec></code> if required.</p> | That JVM can be started from <code><exec></code> if required.</p> | ||||
<pre> | |||||
<java | |||||
fork="true" | |||||
failonerror="true" | |||||
maxmemory="128m" | |||||
module="TestModule" | |||||
modulepath="lib:dist/test.jar"/> | |||||
</pre> | |||||
Runs the module TestModule resolved on the modulepath <tt>lib/:dist/test.jar</tt> | |||||
with a maximum memory of 128MB. Any non zero return code breaks the build. | |||||
<pre> | |||||
<java | |||||
fork="true" | |||||
failonerror="true" | |||||
maxmemory="128m" | |||||
module="TestModule" | |||||
classname="Main"> | |||||
<modulepath> | |||||
<pathelement location="lib"/> | |||||
<pathelement location="dist/test.jar"/> | |||||
</modulepath> | |||||
</java> | |||||
</pre> | |||||
Runs the class Main in module TestModule resolved on the modulepath <tt>lib/:dist/test.jar</tt> | |||||
with a maximum memory of 128MB. Any non zero return code breaks the build. | |||||
</body> | </body> | ||||
</html> | </html> |
@@ -298,7 +298,7 @@ public class Java extends Task { | |||||
* Set the modulepath to be used when running the Java class. | * Set the modulepath to be used when running the Java class. | ||||
* | * | ||||
* @param mp an Ant Path object containing the modulepath. | * @param mp an Ant Path object containing the modulepath. | ||||
* @since ??? | |||||
* @since 1.9.7 | |||||
*/ | */ | ||||
public void setModulepath(Path mp) { | public void setModulepath(Path mp) { | ||||
createModulepath().append(mp); | createModulepath().append(mp); | ||||
@@ -308,7 +308,7 @@ public class Java extends Task { | |||||
* Add a path to the modulepath. | * Add a path to the modulepath. | ||||
* | * | ||||
* @return created modulepath. | * @return created modulepath. | ||||
* @since ??? | |||||
* @since 1.9.7 | |||||
*/ | */ | ||||
public Path createModulepath() { | public Path createModulepath() { | ||||
return getCommandLine().createModulepath(getProject()).createPath(); | return getCommandLine().createModulepath(getProject()).createPath(); | ||||
@@ -318,7 +318,7 @@ public class Java extends Task { | |||||
* Add a path to the upgrademodulepath. | * Add a path to the upgrademodulepath. | ||||
* | * | ||||
* @return created upgrademodulepath. | * @return created upgrademodulepath. | ||||
* @since ??? | |||||
* @since 1.9.7 | |||||
*/ | */ | ||||
public Path createUpgrademodulepath() { | public Path createUpgrademodulepath() { | ||||
return getCommandLine().createUpgrademodulepath(getProject()).createPath(); | return getCommandLine().createUpgrademodulepath(getProject()).createPath(); | ||||
@@ -379,7 +379,7 @@ public class Java extends Task { | |||||
* @param module the name of the module. | * @param module the name of the module. | ||||
* | * | ||||
* @throws BuildException if the jar attribute has been set. | * @throws BuildException if the jar attribute has been set. | ||||
* @since ??? | |||||
* @since 1.9.7 | |||||
*/ | */ | ||||
public void setModule(String module) throws BuildException { | public void setModule(String module) throws BuildException { | ||||
if (getCommandLine().getJar() != null) { | if (getCommandLine().getJar() != null) { | ||||
@@ -374,7 +374,7 @@ public class CommandlineJava implements Cloneable { | |||||
/** | /** | ||||
* Set the module to execute. | * Set the module to execute. | ||||
* @param module the module name. | * @param module the module name. | ||||
* @since ??? | |||||
* @since 1.9.7 | |||||
*/ | */ | ||||
public void setModule(final String module) { | public void setModule(final String module) { | ||||
if (executableType == null) { | if (executableType == null) { | ||||
@@ -404,7 +404,7 @@ public class CommandlineJava implements Cloneable { | |||||
* @return the name of the module to run or <tt>null</tt> if there is no module. | * @return the name of the module to run or <tt>null</tt> if there is no module. | ||||
* @see #getJar() | * @see #getJar() | ||||
* @see #getClassname() | * @see #getClassname() | ||||
* @since ??? | |||||
* @since 1.9.7 | |||||
*/ | */ | ||||
public String getModule() { | public String getModule() { | ||||
if(executableType == ExecutableType.MODULE) { | if(executableType == ExecutableType.MODULE) { | ||||
@@ -442,7 +442,7 @@ public class CommandlineJava implements Cloneable { | |||||
* Create a modulepath. | * Create a modulepath. | ||||
* @param p the project to use to create the path. | * @param p the project to use to create the path. | ||||
* @return a path to be configured. | * @return a path to be configured. | ||||
* @since ??? | |||||
* @since 1.9.7 | |||||
*/ | */ | ||||
public Path createModulepath(Project p) { | public Path createModulepath(Project p) { | ||||
if (modulepath == null) { | if (modulepath == null) { | ||||
@@ -455,7 +455,7 @@ public class CommandlineJava implements Cloneable { | |||||
* Create an upgrademodulepath. | * Create an upgrademodulepath. | ||||
* @param p the project to use to create the path. | * @param p the project to use to create the path. | ||||
* @return a path to be configured. | * @return a path to be configured. | ||||
* @since ??? | |||||
* @since 1.9.7 | |||||
*/ | */ | ||||
public Path createUpgrademodulepath(Project p) { | public Path createUpgrademodulepath(Project p) { | ||||
if (upgrademodulepath == null) { | if (upgrademodulepath == null) { | ||||
@@ -672,7 +672,7 @@ public class CommandlineJava implements Cloneable { | |||||
/** | /** | ||||
* Get the modulepath. | * Get the modulepath. | ||||
* @return modulepath or null. | * @return modulepath or null. | ||||
* @since ??? | |||||
* @since 1.9.7 | |||||
*/ | */ | ||||
public Path getModulepath() { | public Path getModulepath() { | ||||
return modulepath; | return modulepath; | ||||
@@ -681,7 +681,7 @@ public class CommandlineJava implements Cloneable { | |||||
/** | /** | ||||
* Get the upgrademodulepath. | * Get the upgrademodulepath. | ||||
* @return upgrademodulepath or null. | * @return upgrademodulepath or null. | ||||
* @since ??? | |||||
* @since 1.9.7 | |||||
*/ | */ | ||||
public Path getUpgrademodulepath() { | public Path getUpgrademodulepath() { | ||||
return upgrademodulepath; | return upgrademodulepath; | ||||
@@ -783,7 +783,7 @@ public class CommandlineJava implements Cloneable { | |||||
/** | /** | ||||
* Determine whether the modulepath has been specified. | * Determine whether the modulepath has been specified. | ||||
* @return true if the modulepath is to be used. | * @return true if the modulepath is to be used. | ||||
* @since ??? | |||||
* @since 1.9.7 | |||||
*/ | */ | ||||
public boolean haveModulepath() { | public boolean haveModulepath() { | ||||
Path fullClasspath = modulepath != null | Path fullClasspath = modulepath != null | ||||
@@ -795,7 +795,7 @@ public class CommandlineJava implements Cloneable { | |||||
/** | /** | ||||
* Determine whether the upgrademodulepath has been specified. | * Determine whether the upgrademodulepath has been specified. | ||||
* @return true if the upgrademodulepath is to be used. | * @return true if the upgrademodulepath is to be used. | ||||
* @since ??? | |||||
* @since 1.9.7 | |||||
*/ | */ | ||||
public boolean haveUpgrademodulepath() { | public boolean haveUpgrademodulepath() { | ||||
Path fullClasspath = upgrademodulepath != null | Path fullClasspath = upgrademodulepath != null | ||||
@@ -846,7 +846,7 @@ public class CommandlineJava implements Cloneable { | |||||
* @param module the module name. | * @param module the module name. | ||||
* @param classname the classname or <code>null</code>. | * @param classname the classname or <code>null</code>. | ||||
* @return the main module with optional classname command line argument. | * @return the main module with optional classname command line argument. | ||||
* @since ??? | |||||
* @since 1.9.7 | |||||
*/ | */ | ||||
private static String createModuleClassPair(final String module, final String classname) { | private static String createModuleClassPair(final String module, final String classname) { | ||||
return classname == null ? | return classname == null ? | ||||
@@ -858,7 +858,7 @@ public class CommandlineJava implements Cloneable { | |||||
* Parses a module name from JDK 9 main module command line argument. | * Parses a module name from JDK 9 main module command line argument. | ||||
* @param moduleClassPair a module with optional classname or <code>null</code>. | * @param moduleClassPair a module with optional classname or <code>null</code>. | ||||
* @return the module name or <code>null</code>. | * @return the module name or <code>null</code>. | ||||
* @since ??? | |||||
* @since 1.9.7 | |||||
*/ | */ | ||||
private static String parseModuleFromModuleClassPair(final String moduleClassPair) { | private static String parseModuleFromModuleClassPair(final String moduleClassPair) { | ||||
if (moduleClassPair == null) { | if (moduleClassPair == null) { | ||||
@@ -872,7 +872,7 @@ public class CommandlineJava implements Cloneable { | |||||
* Parses a classname from JDK 9 main module command line argument. | * Parses a classname from JDK 9 main module command line argument. | ||||
* @param moduleClassPair a module with optional classname or <code>null</code>. | * @param moduleClassPair a module with optional classname or <code>null</code>. | ||||
* @return the classname or <code>null</code>. | * @return the classname or <code>null</code>. | ||||
* @since ??? | |||||
* @since 1.9.7 | |||||
*/ | */ | ||||
private static String parseClassFromModuleClassPair(final String moduleClassPair) { | private static String parseClassFromModuleClassPair(final String moduleClassPair) { | ||||
if (moduleClassPair == null) { | if (moduleClassPair == null) { | ||||
@@ -886,7 +886,7 @@ public class CommandlineJava implements Cloneable { | |||||
/** | /** | ||||
* Type of execution. | * Type of execution. | ||||
* @since ??? | |||||
* @since 1.9.7 | |||||
*/ | */ | ||||
private enum ExecutableType { | private enum ExecutableType { | ||||
/** | /** | ||||