Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Eclipse ANT task SUCCEED but do not work(Eclipse ANT task SUCCEED but do not work)
icon5.gif  Eclipse ANT task SUCCEED but do not work [message #1719715] Mon, 11 January 2016 16:21 Go to next message
Cosme Fulanito is currently offline Cosme FulanitoFriend
Messages: 2
Registered: January 2016
Junior Member
This is the code of my build.xml:


    <?xml version="1.0" encoding="UTF-8"?>
    <project name="compile-game" default="compile" basedir=".">
      <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
      <target name="compile" description="build class files">
      	<echo message = "Starting compilation." level = "info"/>
        <eclipse.refreshLocal resource="mygame/src" depth="infinite"/>
        <eclipse.incrementalBuild project="mygame" kind="incremental"/>
        <echo message = "Compile complete." level = "info"/>
      </target>
    </project>



This is the output when I do /home/xxxxxx/eclipse/eclipse -application org.eclipse.ant.core.antRunner -f build.xml

Buildfile: build.xml

compile:
[echo] Starting compilation.
[echo] Compile complete.
BUILD SUCCESSFUL

BUILD SUCCESSFUL
Total time: 1 second


This happens even if I put nonsense in the options... like a wrong project name. It also SUCCESS when I put wrong code in my java files.

I am missing something? I can compile from Eclipse but I want to do this from command line so I can integrate with other tool.

What I expect from this is that if I have an error in the project, this will fail. And if it doesn't, it will update the .class files inside the project. Also I'd like to be able to run and/or export to jar the updated code from command line but that's other step Smile

Any help is appreciated. Thanks!
Re: Eclipse ANT task SUCCEED but do not work [message #1719749 is a reply to message #1719715] Mon, 11 January 2016 19:16 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3799
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 01/11/2016 09:22 AM, Cosme Fulanito wrote:
> This is the code of my build.xml:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project name="compile-game" default="compile" basedir=".">
> <property name="build.compiler"
> value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
> <target name="compile" description="build class files">
> <echo message = "Starting compilation." level = "info"/>
> <eclipse.refreshLocal resource="mygame/src" depth="infinite"/>
> <eclipse.incrementalBuild project="mygame" kind="incremental"/>
> <echo message = "Compile complete." level = "info"/>
> </target>
> </project>
>
>
>
> This is the output when I do /home/xxxxxx/eclipse/eclipse -application
> org.eclipse.ant.core.antRunner -f build.xml
> Buildfile: build.xml
>
> compile:
> [echo] Starting compilation.
> [echo] Compile complete.
> BUILD SUCCESSFUL
>
> BUILD SUCCESSFUL
> Total time: 1 second
>
>
> This happens even if I put nonsense in the options... like a wrong
> project name. It also SUCCESS when I put wrong code in my java files.
>
> I am missing something? I can compile from Eclipse but I want to do this
> from command line so I can integrate with other tool.
>
> What I expect from this is that if I have an error in the project, this
> will fail. And if it doesn't, it will update the .class files inside the
> project. Also I'd like to be able to run and/or export to jar the
> updated code from command line but that's other step :)
>
> Any help is appreciated. Thanks!


First, this forum is about setting Eclipse up and using it, not about
general programming issues whether for Java, C/C++, Python, Ant, etc.

Still, to help out, ...

This is the entire code of build.xml?

When I look at your ant code and your problem statement, I'm puzzled as
to why I don't see you using the ant <javac task in your code. It's what
compiles Java code.

Your best and fastest bet is to get some examples of folks' existing
build.xml, copying then tweaking them for your use.

And ask questions about ant on stackoverflow.com setting the ant and
java tags.

Cheers
Re: Eclipse ANT task SUCCEED but do not work [message #1719750 is a reply to message #1719749] Mon, 11 January 2016 19:29 Go to previous message
Cosme Fulanito is currently offline Cosme FulanitoFriend
Messages: 2
Registered: January 2016
Junior Member
Hi, thanks for your answer.

Yes, that was the whole Ant code. I thought it was going to work but finally I decided to try a "normal" ant file (one with multiple targets: clean, compile, jar, etc.). It finally worked, even if I'm not sure if it works incremental as Eclipse does.

I'll have your suggestions about asking questions in mind, thanks.
Previous Topic:Eclipse installer error
Next Topic:How to import a text document and put each line in an array
Goto Forum:
  


Current Time: Mon Sep 16 13:01:21 GMT 2019

Powered by FUDForum. Page generated in 0.02995 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top