ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Usage/projecthelp failing
Date Fri, 19 Jul 2002 20:40:28 GMT
Then all that remains is applying this patch to Ant (it's on the 1.5 branch,
but shouldn't be much different for the HEAD), an adding the NO_EXIT=true
Java system property. Getting this patch accepted for 1.5.1 in another story
I guess, and is out of my hands ;-) Doesn't help you much though, huh! --DD

PS: Could have been a -noexit switch instead, but that would have required a
bit more changes to Main.java, so I went for that one.

<target name="usage">
  <java classname="org.apache.tools.ant.Main">
    <sysproperty key="NO_EXIT" value="true" />
    <arg value="-projecthelp" />
    <arg value="-buildfile" />
    <arg value="${ant.file}" />
  </java>
</target>

P:\org_apache\jakarta-ant-ANT_15_BRANCH>cvs diff -u
src\main\org\apache\tools\ant\Main.java
Index: src/main/org/apache/tools/ant/Main.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/Main.java,v
retrieving revision 1.65.2.7
diff -u -r1.65.2.7 Main.java
--- src/main/org/apache/tools/ant/Main.java     5 Jul 2002 11:36:08 -0000
1.65.2.7
+++ src/main/org/apache/tools/ant/Main.java     19 Jul 2002 20:34:04 -0000
@@ -123,6 +123,11 @@
     private String inputHandlerClassname = null;

     /**
+     * Whether or not Ant should call System.exit(code) when done.
+     */
+    private static final boolean NO_EXIT = Boolean.getBoolean("NO_EXIT");
+
+    /**
      * Whether or not output to the log is to be unadorned.
      */
     private boolean emacsMode = false;
@@ -171,8 +176,8 @@
      * @param coreLoader Classloader used for core classes. May be
      *        <code>null</code> in which case the system classloader is
used.
      */
-    public static void start(String[] args, Properties
additionalUserProperties,
-                             ClassLoader coreLoader) {
+    public static int start(String[] args, Properties
additionalUserProperties,
+                            ClassLoader coreLoader) {
         Main m = null;

         try {
@@ -180,7 +185,7 @@
             m = new Main(args);
         } catch (Throwable exc) {
             printMessage(exc);
-            System.exit(1);
+            return 1;
         }

         if (additionalUserProperties != null) {
@@ -194,16 +199,16 @@

         try {
             m.runBuild(coreLoader);
-            System.exit(0);
+            return 0;
         } catch (BuildException be) {
             if (m.err != System.err) {
                 printMessage(be);
             }
-            System.exit(1);
+            return 1;
         } catch (Throwable exc) {
             exc.printStackTrace();
             printMessage(exc);
-            System.exit(1);
+            return 1;
         } finally {
             if (isLogFileUsed) {
                 if (out != null) {
@@ -232,7 +237,10 @@
      * @param args Command line arguments. Must not be <code>null</code>.
      */
     public static void main(String[] args) {
-        start(args, null, null);
+        int returnCode = start(args, null, null);
+        if (!NO_EXIT) {
+            System.exit(returnCode);
+        }
     }

     // XXX: (Jon Skeet) Error handling appears to be inconsistent here.

P:\org_apache\jakarta-ant-ANT_15_BRANCH>

-----Original Message-----
From: Mike Cepek [mailto:mcepek@smsi.com] 
Sent: Friday, July 19, 2002 3:18 PM
To: Ant Users List
Subject: RE: Usage/projecthelp failing

Dominique Devienne <DDevienne@lgc.com> wrote:

> Yeah, that would be my bet too. You could always add
> the fork='true' attribute to <java>, and see if
> NetBeans like that better. --DD

Nope.  NetBeans, Win2K and Linux all do this with fork=true added:

projecthelp:
java.lang.NoClassDefFoundError: org/apache/tools/ant/Main
Exception in thread "main" 
Java Result: 1
BUILD SUCCESSFUL

Pretty odd.


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message