Somehow I think it has to do with the <junit dir="." printSummary="yes"
fork="true" forkmode="once" showoutput="true"> if I add any command before
that.. it runs good, just like making the directory such as the echo
command.. here is the whole target:


    <target name="test-javalanche">

        <echo>
            project.prefix     :${javalanche.arg.line}
        </echo>


        <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
Sent from Frankfurt Am Main, HE, Germany

On Tue, Oct 13, 2009 at 4:12 PM, David Nemer <davidne...@gmail.com> wrote:

> 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.knuple...@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:davidne...@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-unsubscr...@ant.apache.org
>>> For additional commands, e-mail: user-h...@ant.apache.org
>>>
>>>
>>
>

Reply via email to