• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Creating Workspace from an Old One in Eclipse

 
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello I have a couple of Eclipse projects which I need to re-create. Should I create a new workspace and then import it all in there?

Thanks,
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is one way of doing it.

What exactly do you mean by "re-create"? Are the old projects not in a workspace? Perhaps if you gave us a few more details we could be more helpful.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, I just saw this post: https://coderanch.com/t/570391/vc/Finding-Workspaces-Directory
Is that what you are asking about? If so, then yes, just create a new workspace and import the projects into it. You might want to clean up the existing projects first, though. By clean up, I mean remove all created files (.class, .jar, etc.). You do this because all you really want to import are the source files. (By the way, this is the mechanism used in development shops where sources are stored in a version control system such as Subversion.)

Another alternative is to simply create new projects in your workspace and copy the sources from the old projects into the new projects. I usually do this when I am changing the build mechanism (usually to using Maven).
 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi okay, I think I have it, I need to spend some time not importing everything into the project.

Sort of like this:

1) copy to a directory
2) delete the .class and .jar files
3) import into a new project

Just for kicks, then how do I re-create the classes later on, just run the project or compiling them? It is a desktop application, not an internet application.

Also I have never used subversion, I have only used cvs. Can you recommend a place to go to learn more about subversion?

 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

how do I re-create the classes later on


Ask Eclipse to build them (actually, unless you turn off auto-build within Eclipse, it builds them automatically). Unless you have an Ant or Maven build script (highly recommended), in which case you would use that.

CVS is a version control system, just like Subversion. Eclipse even has built-in support for CVS. If the sources are already in CVS, as long as you know the repository URL for the project, you can have Eclipse import the projects.

If you want to learn about Subversion, google subversion tutorial.
 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter, thanks, I guess what I should do is this:

1). turn the auto build off
2). import the project
3). use ant??

I have a question, how can I tell if the previous developer used ant, and also how can I also utilize ant? I have used it before but it has been many months.

Thanks, Michele
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Michele Smith wrote:how can I tell if the previous developer used ant, and also how can I also utilize ant?


Is there a build.xml file in the base directory of the project? If so, then Ant is used to build the project. (If, on the other hand, there is a file name pom.xml, then Maven is used as the build tool.)

If there is no build.xml file, you can always create one yourself. The advantage of doing so is that you can then set up a Continuous Integration environment where your project is built using an automated build process of a build machine. On the other hand, if you are the only person working on the project, and you don't mind doing builds manually by yourself, then you don't really need an Ant build script. (In our shop, all developers commit their sources to Subversion, then we use Jenkins to compile those sources on dedicated build machines. We use Maven for all of our builds. Developers are free to build things on their PCs, but such builds are never used in production - only builds performed by Jenkins ever go into production.)
 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello I understand what you mean now. I just have one last question related to this post and that would be:

after you have located the ant script and made any necessary edits, what steps must you undertake to build the project? If it is a web project, it must have a server, right? Then you can build the project utilizing the Project/Build All with the ant script to get the necessary .class files et al etc?

Is this correct or am I incorrect and need some re-work on this?


Thanks,
Michele
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to build the project depends on a number of things. You should be able to build the project from the command line by running ant and giving an appropriate target. For the script you posted at https://coderanch.com/t/570797/vc/do-edited-servlet you would run either:

ant recompile

or

ant compile

Which one you do depends on whether you want to do a clean before a compile or not. If you don't do the clean, only the changed code will re recompiled. Not that recompiling only changed code has the possibility of causing various problems. Personally, I always clean and then compile.

Back to the "how to compile" question, you might be able to compile from within Eclipse, but that all depends on whether the Eclipse project is set up to use Ant to build the app. To find that out, right-click the project in Eclipse, select Properties and look under Build. If one of the Builders has an icon that looks like an ant, then Ant is being used for the build.

After the build, there will be either a directory containing the web app contents, or there will be a WAR file (based on your build.xml, there is no WAR file). Deploying the app requires that you copy the web app to the server.
 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello again I looked and there is no ant under the build.

Does this mean it is not actually using the build.xml file?

Thanks, Michele
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Does this mean it is not actually using the build.xml file?


Yes.
 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure really. What I mean is that I use Eclipse to build, and the place ant points to produces no build.

Does ant have to be run separately or can you just utilize Eclipse to build the project even if ant is in there with the project?

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic