ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Nemer <davidne...@gmail.com>
Subject Re: Ant and Java Forking
Date Tue, 13 Oct 2009 14:12:56 GMT
In the line p.executeTarget(p.getDefaultTarget());
I have p.executeTarget("test-javalanche"); instead


> This is the code that I'm using to invoke 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());
> p.fireBuildFinished(null);
>
> >Did you ever start Ant sucessfully through a Java application?
> Yes, I tried to run some other targets in my XML file and it ran perfectly,
> the problem is when I try to run a target that contains: <jvmarg
> line="${javalanche.arg.line}" /> So I think the problem is the JVMARG.
>
> > What is happeneing?
> Nothing. it simply doesn't run the line <jvmarg
> line="${javalanche.arg.line}" /> I was able to print the arguments from
> "javalanche.arg.line" so there is no problems with the argument passing...
>
> >Why do you need to do it prgrammatically?
> I'm writing an aplication for my thesis which I need to check out a
> project, build it, test it (with ant) and run the javalanche.xml thru ant.
>
> > Do you mean  the same JVM??
> I was just wondering since I'm calling ant from a Java process if there is
> a problem to call a JVMARG (which is another java process). I don't really
> know, i was just wondering if this could ring a bell to someone.
>
> Cheers,
> --
> David Nemer
> Sent from Frankfurt Am Main, HE, Germany
>
> On Tue, Oct 13, 2009 at 8:14 AM, Knuplesch, Juergen <
> Juergen.Knuplesch@icongmbh.de> wrote:
>
>> Hello,
>>
>> Please show a bit of your Java Code. Otherwise it is difficult to
>> understand what you mean.
>> What is happeneing?
>>
>> Did you ever start Ant sucessfully through a Java application?
>>
>> It is possible to do this!
>> Why do you need to do it prgrammatically?
>>
>> "is because they both use JVM"
>> Do you mean  the same JVM??
>>
>> Greetings Juergen
>>
>> -----Urspr√ľngliche Nachricht-----
>> Von: David Nemer [mailto:davidnemer@gmail.com]
>> Gesendet: Montag, 12. Oktober 2009 02:25
>> An: Ant Users List
>> Betreff: Ant and Java Forking
>>
>>
>> Hi,
>>
>> I'm invoking Ant through Java to run the target (as shown bellow)
>> "test-javalanche", apparently it doesn't run the target... this target I'm
>> trying to run also runs with the Java Virtual Machine. So I was wondering if
>> the fact that I can't run Ant (programmatically) and call this target
>> (test-javalanche) is because they both use JVM. If it is, does anyone
>> suggest a solution?
>>
>> <target name="test-javalanche">
>>        <mkdir dir="mutation-files/junit-reports"></mkdir>
>>        <junit dir="." printSummary="yes" fork="true" forkmode="once"
>> showoutput="true">
>>            <classpath>
>>                <path refid="javalanche.classpath.add" />
>>                <pathelement path="${cp}"></pathelement>
>>            </classpath>
>>
>>            <jvmarg line="${javalanche.arg.line}" />
>>
>>            <formatter type="xml"/>
>>            <formatter usefile="true" type="plain"/>
>>            <test todir="mutation-files/junit-reports" name="${testsuite}"
>> />
>>        </junit>
>>    </target>
>>
>> --
>> David Nemer
>>
>> ---------------------------------------------------------------------
>> 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