You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2003/12/07 10:46:54 UTC

cvs commit: jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container AbstractJavaContainer.java

vmassol     2003/12/07 01:46:54

  Modified:    integration/ant/src/java/org/apache/cactus/integration/ant/container/jboss
                        JBoss3xContainer.java
               integration/ant/src/java/org/apache/cactus/integration/ant/container/tomcat
                        AbstractCatalinaContainer.java
               documentation/docs/xdocs changes.xml
               integration/ant/src/java/org/apache/cactus/integration/ant/container/orion
                        AbstractOrionContainer.java
               integration/ant/src/java/org/apache/cactus/integration/ant/container
                        AbstractJavaContainer.java
  Log:
          <action dev="VMA" type="fix" due-to="Joe Germuska" due-to-email="Joe@Germuska.com">
            Make the <code>&lt;cactus&gt;</code> task work on Mac OSX by not 
            including the <code>tools.jar</code> file (on Max OSX all classes
            are found in <code>classes.jar</code>).
          </action>
  
  Note: I haven't tried it as I'm not running Max OSX
  
  Revision  Changes    Path
  1.10      +4 -14     jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/jboss/JBoss3xContainer.java
  
  Index: JBoss3xContainer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/jboss/JBoss3xContainer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JBoss3xContainer.java	23 Oct 2003 12:27:42 -0000	1.9
  +++ JBoss3xContainer.java	7 Dec 2003 09:46:54 -0000	1.10
  @@ -57,7 +57,6 @@
   package org.apache.cactus.integration.ant.container.jboss;
   
   import java.io.File;
  -import java.io.FileNotFoundException;
   import java.io.IOException;
   import java.util.jar.Attributes;
   import java.util.jar.JarFile;
  @@ -213,19 +212,10 @@
                   createSysProperty("jboss.server.home.url",
                       new File(configDir, this.config).toURL().toString()));
   
  -            Path classPath = java.createClasspath();
  -            classPath.createPathElement().setLocation(
  +            Path classpath = java.createClasspath();
  +            classpath.createPathElement().setLocation(
                   new File(binDir, "run.jar"));
  -            try
  -            {
  -                classPath.createPathElement().setLocation(getToolsJar());
  -            }
  -            catch (FileNotFoundException fnfe)
  -            {
  -                getLog().warn(
  -                    "Couldn't find tools.jar (needed for JSP compilation)");
  -            }
  -
  +            addToolsJarToClasspath(classpath);
               java.setClassname("org.jboss.Main");
               java.createArg().setValue("-c");
               java.createArg().setValue(this.config);
  
  
  
  1.7       +2 -11     jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/tomcat/AbstractCatalinaContainer.java
  
  Index: AbstractCatalinaContainer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/tomcat/AbstractCatalinaContainer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractCatalinaContainer.java	23 Nov 2003 17:03:59 -0000	1.6
  +++ AbstractCatalinaContainer.java	7 Dec 2003 09:46:54 -0000	1.7
  @@ -57,7 +57,6 @@
   package org.apache.cactus.integration.ant.container.tomcat;
   
   import java.io.File;
  -import java.io.FileNotFoundException;
   import java.io.IOException;
   import java.util.Properties;
   import java.util.jar.JarFile;
  @@ -200,15 +199,7 @@
           Path classpath = java.createClasspath();
           classpath.createPathElement().setLocation(
               new File(getDir(), "bin/bootstrap.jar"));
  -        try
  -        {
  -            classpath.createPathElement().setLocation(getToolsJar());
  -        }
  -        catch (FileNotFoundException fnfe)
  -        {
  -            getLog().warn(
  -                "Couldn't find tools.jar (needed for JSP compilation)");
  -        }
  +        addToolsJarToClasspath(classpath);
           java.setClassname("org.apache.catalina.startup.Bootstrap");
           java.createArg().setValue(theArg);
           java.execute();
  
  
  
  1.147     +5 -0      jakarta-cactus/documentation/docs/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/documentation/docs/xdocs/changes.xml,v
  retrieving revision 1.146
  retrieving revision 1.147
  diff -u -r1.146 -r1.147
  --- changes.xml	6 Dec 2003 10:38:41 -0000	1.146
  +++ changes.xml	7 Dec 2003 09:46:54 -0000	1.147
  @@ -68,6 +68,11 @@
         </devs>
   
         <release version="1.6dev" date="in CVS">
  +        <action dev="VMA" type="fix" due-to="Joe Germuska" due-to-email="Joe@Germuska.com">
  +          Make the <code>&lt;cactus&gt;</code> task work on Mac OSX by not 
  +          including the <code>tools.jar</code> file (on Max OSX all classes
  +          are found in <code>classes.jar</code>).
  +        </action>
           <action dev="VMA" type="fix" due-to="Kazuhito SUGURI" due-to-email="suguri.kazuhito@lab.ntt.co.jp">
             Prevent requiring <code>commons-httpclient</code> jar to be present
             on the server-side classpath.
  
  
  
  1.7       +2 -11     jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/orion/AbstractOrionContainer.java
  
  Index: AbstractOrionContainer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/orion/AbstractOrionContainer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractOrionContainer.java	13 Sep 2003 10:05:46 -0000	1.6
  +++ AbstractOrionContainer.java	7 Dec 2003 09:46:54 -0000	1.7
  @@ -57,7 +57,6 @@
   package org.apache.cactus.integration.ant.container.orion;
   
   import java.io.File;
  -import java.io.FileNotFoundException;
   import java.io.IOException;
   
   import org.apache.cactus.integration.ant.container.AbstractJavaContainer;
  @@ -185,15 +184,7 @@
           fileSet.setDir(this.dir);
           fileSet.createInclude().setName("*.jar");
           classpath.addFileset(fileSet);
  -        try
  -        {
  -            classpath.createPathElement().setLocation(getToolsJar());
  -        }
  -        catch (FileNotFoundException fnfe)
  -        {
  -            getLog().warn(
  -                "Couldn't find tools.jar (needed for JSP compilation)");
  -        }
  +        addToolsJarToClasspath(classpath);
           java.setClassname("com.evermind.server.ApplicationServer");
           java.createArg().setValue("-config");
           java.createArg().setFile(new File(tmpDir, "conf/server.xml"));
  
  
  
  1.6       +44 -6     jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/AbstractJavaContainer.java
  
  Index: AbstractJavaContainer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/container/AbstractJavaContainer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractJavaContainer.java	30 Nov 2003 11:53:58 -0000	1.5
  +++ AbstractJavaContainer.java	7 Dec 2003 09:46:54 -0000	1.6
  @@ -197,17 +197,54 @@
       }
   
       /**
  -     * Returns the file containing the JDK tools (such as the compiler).
  +     * Adds the tools.jar to the classpath, except for Mac OSX as it is not
  +     * needed.
  +     * 
  +     * @param theClasspath the classpath object to which to add the tools.jar
  +     */
  +    protected final void addToolsJarToClasspath(Path theClasspath)
  +    {
  +        // On OSX, the tools.jar classes are included in the classes.jar so 
  +        // there is no need to include any tools.jar file to the cp.
  +        if (!isOSX())
  +           {    
  +            try
  +            {
  +                theClasspath.createPathElement().setLocation(getToolsJar());
  +            }            
  +            catch (FileNotFoundException fnfe)
  +            {
  +                getLog().warn(
  +                    "Couldn't find tools.jar (needed for JSP compilation)");
  +            }
  +        }
  +    }
  +    
  +    // Private Methods -------------------------------------------------------
  +
  +    /**
  +     * Is the user running on a Macintosh OS X system?  Heuristic derived from
  +     * <a href="http://developer.apple.com/technotes/tn/tn2042.html#Section0_1">
  +     * Apple Tech Note 2042</a>.
  +     *
  +     * @return true if the user's system is determined to be Mac OS X.
  +     */
  +    private final boolean isOSX()
  +    {
  +        return (System.getProperty("mrj.version") != null);
  +    }    
  +
  +    /**
  +     * Returns the file containing the JDK tools (such as the compiler). This
  +     * method must not be called on Mac OSX as there is no tools.jar file on
  +     * that platform (everything is included in classes.jar).
        * 
        * @return The tools.jar file
        * @throws FileNotFoundException If the tools.jar file could not be found
        */
  -    protected final File getToolsJar()
  -        throws FileNotFoundException
  +    protected final File getToolsJar() throws FileNotFoundException
       {
           String javaHome = System.getProperty("java.home"); 
  -        // TODO: Fix this as it fails on Max OSX (which doesn't have a 
  -        // tools.jar file).
           File toolsJar = new File(javaHome, "../lib/tools.jar");
           if (!toolsJar.isFile())
           {
  @@ -215,4 +252,5 @@
           }
           return toolsJar;
       }   
  +    
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org