[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Ant NEWBIE: Can Ant save (open) source automatically before build?

Posted on 2006-03-20
6
Medium Priority
?
234 Views
Last Modified: 2010-03-31
Dear Ant Experts,

In Eclipse, I have a build.xml.  Each time I run it, I'm prompted to save the (Java) source I'm currently editing.  (I always want to save it.)  I have not been able to get Eclipse to save it automatically.  Can I add something to my build.xml that will save all changed files in my ...src directory before building (even if I currently have them open in Eclipse?)

Here is my build.xml:

<?xml version="1.0"?>
<project name="project" default="copy">
      <property name="outputDir" value="C:\FTG\Projects\Total\classes" />
      <property name="sourceDir" value="C:\FTG\Projects\Total\src" />
      <property name="libsDir" value="C:\FTG\Projects\Total_Libraries" />
     <target name="build">
          <path id="mypath">
               <fileset dir="C:\FTG\Projects\Total_Libraries" id="id">
                    <include name="**/*.jar" />
               </fileset>
          </path>
          <javac srcdir="${sourceDir}" destdir="classes" classpathref="mypath" includes="*.java">
          </javac>
     </target>
    <target name="copy" depends="build" >
          <copy todir="\\Ftgds\Program Files\MyCompany\Total\j2re1.4.1_03\bin">
        <fileset dir=".\classes"/>
      </copy>
      <copy todir="C:\Program Files\MyCompany\Total\j2re1.4.1_03\bin">
    <fileset dir=".\classes"/>
  </copy>
    </target>
</project>


Thanks,
BrianMc1958
0
Comment
Question by:BrianMc1958
6 Comments
 
LVL 92

Expert Comment

by:objects
ID: 16240797
no :)

are you running build from eclipse or command line
0
 

Author Comment

by:BrianMc1958
ID: 16240872
I'm running from Eclipse.  

Specifically, I hit the "Run MyProject build.xml" button (green arrow with little red thing), which then does run my build.xml.

I posted this because a previous post failed (at least for me) to get Eclipse to save automatically.  (Someone told me an obvious solution: Preferences > WorkSpace > Save automatically.  Duh. But for some reason, it doesn't work for me).  

Is there a work-around?

--BrianMc1958
0
 
LVL 10

Accepted Solution

by:
radarsh earned 500 total points
ID: 16241168
Hi BrianMc1958,

There is a preference in eclipse which you can set for that.
It will automatically save all dirty editors (unsaved editors) before running.

Go to Window -> Preferences -> Run/Debug -> Launching

There, you can see a radio button "Save dirty editors before launching"
Set that option to always and it will never again ask you for saving!!


________
radarsh
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 86

Expert Comment

by:CEHJ
ID: 16241213
Just open up the command prompt, and, making sure the classpath and libraries are set in accordance with Eclipse, run it from the command line
0
 

Author Comment

by:BrianMc1958
ID: 16241331
Dear radarsh:

Thanks! It works!  I'm HAPPY NOW!

--BrianMc1958
0
 
LVL 10

Expert Comment

by:radarsh
ID: 16241414
:)

I have posted a comment at one of your previous questions regarding same topic.
Please check that too.

________
radarsh
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month18 days, 17 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question