ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Nemer <davidne...@gmail.com>
Subject Re: Java in JDK but ANT can't find it!
Date Mon, 18 May 2009 20:51:18 GMT
This is the result I get from building it from my Java code:

build-all:

init:

setproxy:

xfire.get-deps:
    [mkdir] Created dir: /scratch2/nemer/test/xfire/target/lib
    [mkdir] Created dir: /scratch2/nemer/test/xfire/xfire-core/target/lib

-download-dep:
      [get] Getting:
http://www.ibiblio.org/maven/geronimo-spec/jars/geronimo-spec-activation-1.0.2-rc4.jar
      [get] To:
/scratch2/nemer/test/xfire/target/lib/geronimo-spec-activation-1.0.2-rc4.jar

-download-dep:
      [get] Getting:
http://www.ibiblio.org/maven/woodstox/jars/wstx-asl-2.9.jar
      [get] To: /scratch2/nemer/test/xfire/target/lib/wstx-asl-2.9.jar

-download-dep:
      [get] Getting:
http://www.ibiblio.org/maven/stax/jars/stax-1.1.2-dev.jar
      [get] To: /scratch2/nemer/test/xfire/target/lib/stax-1.1.2-dev.jar

-download-dep:
      [get] Getting: http://www.ibiblio.org/maven/stax/jars/stax-api-1.0.jar
      [get] To: /scratch2/nemer/test/xfire/target/lib/stax-api-1.0.jar

-download-dep:
      [get] Getting: http://www.ibiblio.org/maven/jdom/jars/jdom-1.0.jar
      [get] To: /scratch2/nemer/test/xfire/target/lib/jdom-1.0.jar

-download-dep:
      [get] Getting:
http://www.ibiblio.org/maven/wsdl4j/jars/wsdl4j-1.5.2.jar
      [get] To: /scratch2/nemer/test/xfire/target/lib/wsdl4j-1.5.2.jar

-download-dep:
      [get] Getting:
http://www.ibiblio.org/maven/commons-logging/jars/commons-logging-1.0.4.jar
      [get] To:
/scratch2/nemer/test/xfire/target/lib/commons-logging-1.0.4.jar

-download-dep:
      [get] Getting:
http://www.ibiblio.org/maven/servletapi/jars/servletapi-2.3.jar
      [get] To: /scratch2/nemer/test/xfire/target/lib/servletapi-2.3.jar

-download-dep:
      [get] Getting:
http://www.ibiblio.org/maven/httpunit/jars/httpunit-1.6.1.jar
      [get] To: /scratch2/nemer/test/xfire/target/lib/httpunit-1.6.1.jar

-download-dep:
      [get] Getting:
http://www.ibiblio.org/maven/jaxen/jars/jaxen-1.1-beta-8.jar
      [get] To: /scratch2/nemer/test/xfire/target/lib/jaxen-1.1-beta-8.jar

-download-dep:
      [get] Getting:
http://www.ibiblio.org/maven/easymock/jars/easymock-1.1.jar
      [get] To: /scratch2/nemer/test/xfire/target/lib/easymock-1.1.jar

-download-dep:
      [get] Getting:
http://www.ibiblio.org/maven/xmlunit/jars/xmlunit-1.0.jar
      [get] To: /scratch2/nemer/test/xfire/target/lib/xmlunit-1.0.jar

get-deps:

-download-dep:
      [get] Getting:
http://www.ibiblio.org/maven/commons-httpclient/jars/commons-httpclient-3.0.jar
      [get] To:
/scratch2/nemer/test/xfire/target/lib/commons-httpclient-3.0.jar

-download-dep:
      [get] Getting:
http://www.ibiblio.org/maven/commons-codec/jars/commons-codec-1.3.jar
      [get] To: /scratch2/nemer/test/xfire/target/lib/commons-codec-1.3.jar

-download-dep:
      [get] Getting:
http://www.ibiblio.org/maven/jetty/jars/org.mortbay.jetty-5.1.3.jar
      [get] To:
/scratch2/nemer/test/xfire/xfire-core/target/lib/org.mortbay.jetty-5.1.3.jar

-download-dep:
      [get] Getting:
http://www.ibiblio.org/maven/org.apache.ws.commons/jars/XmlSchema-1.0.jar
      [get] To:
/scratch2/nemer/test/xfire/xfire-core/target/lib/XmlSchema-1.0.jar

-download-dep:
      [get] Getting: http://www.ibiblio.org/maven/junit/jars/junit-3.8.1.jar
      [get] To: /scratch2/nemer/test/xfire/target/lib/junit-3.8.1.jar

compile:
    [mkdir] Created dir:
/scratch2/nemer/test/xfire/xfire-core/target/classes
    [javac] Compiling 225 source files to
/scratch2/nemer/test/xfire/xfire-core/target/classes

BUILD SUCCESSFUL
Total time: 32 seconds

But I still get that error msg that JAVA_HOME is not pointed to a JDK Java.
--
David Nemer
Sent from Kaiserslautern, RP, Germany

On Mon, May 18, 2009 at 10:40 PM, David Nemer <davidnemer@gmail.com> wrote:

> Hey Derek,
>
> I tried to do what you did, but I still get the error.. I added the ACL to
> my code and tools/jar to my PATH... but still doesn't work. Here is a piece
> of my code.. I just wonder.. what else do you do with the ACL???
>
>             Project p = new Project();
>
>             boolean t = true;
>             Path path = null;
>             AntClassLoader ACL = new AntClassLoader(p, path, t);
>
>             p.setUserProperty("ant.file", buildFile.getAbsolutePath());
>             DefaultLogger consoleLogger = new DefaultLogger();
>             consoleLogger.setErrorPrintStream(System.err);
>             consoleLogger.setOutputPrintStream(System.out);
>             consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
>             p.addBuildListener(consoleLogger);
>
>
>
>             try {
>                 p.fireBuildStarted();
>                 p.init();
>                 ProjectHelper helper = ProjectHelper.getProjectHelper();
>                 p.addReference("ant.projectHelper", helper);
>                 helper.parse(p, buildFile);
>
>                 p.executeTarget(p.getDefaultTarget());
>                 p.fireBuildFinished(null);
>
>                 db.insertBuildData(Integer.toString(revisionNumber), "YES",
> "");
>             } catch (BuildException e) {
>
>                 if (e.toString().contains("Unable to find a javac
> compiler;")){
>
>                     db.insertBuildData(Integer.toString(revisionNumber),
> "YES", "Unable to find a javac compiler");
>
>                 } else{
>                      db.insertBuildData(Integer.toString(revisionNumber),
> "NO", e.toString());
>                 }
>             }
>
> --
> David Nemer
> Sent from Kaiserslautern, RP, Germany
>
> On Mon, May 18, 2009 at 3:33 PM, Cole, Derek E <derek.e.cole@lmco.com>wrote:
>
>> Here is how I have set this up to work:
>>
>> Project Antproject = new Project();
>>
>> boolean t = true;
>> Path path = null;
>> AntClassLoader ACL = new AntClassLoader(Antproject, path, t);
>> //this causes ant to use the system path classpath since I passed in a
>> "true" value. To append //items, use something besides path = null.
>> Antproject.setUserProperty("ant.file", someFile.getAbsolutePath());
>> Antproject.fireBuildStarted();
>> Antproject.init();
>> ProjectHelper helper = ProjectHelper.getProjectHelper();
>> Helper.parse(antproject, someFile);
>> Antproject.executeTarget("package");
>> Antproject.fireBuildFinished(null);
>>
>> This is not the complete source, but I did have to add some methods,
>> etc. You will probably want to add some stuff to the classpath to
>> include all the jar files in ant/lib directory. I also added the
>> java_home/lib/tools.jar to the classpath on my system.
>>
>> I am going to start a blog with some of this info, because I also had a
>> heck  of a time capturing the javac tasks output when adding a logger to
>> the build, as well as some other issues.
>>
>>
>> I was running this java program using a <java> task in a separate ant
>> file, btw. I also intend to fire a version from a perl script.
>>
>>
>> -----Original Message-----
>> From: Ashley Williams [mailto:ashpublic@mac.com]
>> Sent: Sunday, May 17, 2009 9:00 AM
>> To: Ant Users List
>> Subject: Re: Java in JDK but ANT can't find it!
>>
>> Hi David,
>>
>> I never meant that you should modify the ant code.
>> Try launching your app with the fully qualified
>> path to the jdk java eg:
>>
>>  > /path/to/jdk/bin/java MyTestApp
>>
>> So in other words don't rely on your PATH environment variable. It
>> could be
>> also that the bootclasspath has been overridden so that tools.jar has
>> been
>> taken out. Are you on the mac, in which case you don't have tools.jar?
>>
>> Try the same experiment by stealing the very last line in the ant
>> launcher
>> script and hardcoding the values that you know you need to use. On my
>> installation of ant I would start with this line:
>>
>> ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -classpath
>> \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=
>> \"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher
>> $ANT_ARGS -cp \"$CLASSPATH\" $ant_exec_args"
>>
>> I say this again, the idea behind this is that you need to assume that
>> your
>> environment variables and shell scripts can't be trusted and therefore
>> bipass them.
>>
>> I mentioned this before, but remove any compiler fork option so that
>> the task
>> is being executed in the same vm. Then if it behaves differently in a
>> forked
>> vm, you know that the vm environment isn't being inherited properly and
>> that's where you need to look.
>>
>> You could try removing all java installations from your machine and then
>> reinstalling just the jdk that you need. I know for example that windows
>> gets up to tricks such as adding a java.exe in the windows system
>> directory
>> that is always first in the PATH that you have to remember to manually
>> delete.
>>
>> Sorry you are having all these frustrating problems, good luck.
>>
>>
>> On 16 May 2009, at 20:25, David Nemer wrote:
>>
>> > Just a remark, when I run the application and /opt/jdk1.6.0_06/lib/
>> > tools.jar
>> > to the classpath. It gives me a different error message:  "Compile
>> > failed;
>> > see the compiler error output for details." there is no error msg
>> > and it
>> > still says BUILD SUCCESSFUL
>> >
>> >
>> > --
>> > David Nemer
>> > Sent from Kaiserslautern, RP, Germany
>> >
>> > On Sat, May 16, 2009 at 9:11 PM, David Nemer <davidnemer@gmail.com>
>> > wrote:
>> >
>> >> Hello Michael,
>> >>
>> >> here is my code on how I'm invoking Ant:
>> >>
>> >>            Project p = new Project();
>> >>            p.setUserProperty("ant.file",
>> >> buildFile.getAbsolutePath());
>> >>            DefaultLogger consoleLogger = new DefaultLogger();
>> >>            consoleLogger.setErrorPrintStream(System.err);
>> >>            consoleLogger.setOutputPrintStream(System.out);
>> >>            consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
>> >>            p.addBuildListener(consoleLogger);
>> >>            p.fireBuildStarted();
>> >>            p.init();
>> >>            ProjectHelper helper = ProjectHelper.getProjectHelper();
>> >>            p.addReference("ant.projectHelper", helper);
>> >>            helper.parse(p, buildFile);
>> >>            p.executeTarget(p.getDefaultTarget());
>> >>
>> >> Michael, I read somewhere that when you invoke ANT in java, it runs
>> >> in the
>> >> same JVM, and forking the ANT process might solve it. Do you have
>> >> any idea
>> >> how would I code this?? Make Ant ran in another JVM?
>> >>
>> >>
>> >> --
>> >> David Nemer
>> >> Sent from Kaiserslautern, RP, Germany
>> >>
>> >> On Sat, May 16, 2009 at 9:03 PM, Michael Ludwig <milu71@gmx.de>
>> >> wrote:
>> >>
>> >>> David Nemer schrieb am 16.05.2009 um 20:51:31 (+0200):
>> >>>
>> >>>> nemer@kubrick:~$ java -jar
>> >>> /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar
>> >>>> -version
>> >>>> Apache Ant version 1.7.1 compiled on June 27 2008
>> >>>>
>> >>>> nemer@kubrick:~$ /opt/jdk1.6.0_06/bin/java -jar
>> >>>> /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar -version
>> >>>> Apache Ant version 1.7.1 compiled on June 27 2008
>> >>>>
>> >>>> so just running JAVA worked as well as running /opt/jdk1.6.0_06/
>> >>>> bin/java
>> >>>
>> >>> So tools.jar is found alright. It's an environmental problem,
>> >>> either in
>> >>> the ant shell script (has that been tampered with?) or, more
>> >>> likely, the
>> >>> shell script you're using to launch it.
>> >>>
>> >>> Michael Ludwig
>> >>>
>> >>>
>> ---------------------------------------------------------------------
>> >>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> >>> For additional commands, e-mail: user-help@ant.apache.org
>> >>>
>> >>>
>> >>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message