How do I view Ant scripts that eclipse uses? - java

I am having a bit of trouble building my project with Ant. I wanted to take a look at the Ant scripts that eclipse uses to build my project. How can I do this?

I don't think eclipse uses ant scripts to build your project by default. However, eclipse can generate ant scripts for you. This can be done by right click project > export > General > Ant buildfiles. Make sure you uncheck the 'use eclipse compiler' if you want the build file to be usable from outside of eclipse.

No ant scripts are used building in the workspace, however, exporting your projects does use ant scripts. You can generate such scripts by right click on the MANIFEST.MF or feature.xml and PDE Tools -> Create Ant Build File.
The exact contents of the generated ant scripts will depend on the options selected for export, so there may be some differences.

Select Project » Properties » Builders to see what runs when Eclipse builds your project.

Related

Difference between "IntelliJ", "Maven" and "Gradle" build system in IntelliJ IDEA?

What is the difference between IntelliJ, Maven and Gradle build system in IntelliJ IDEA?
Has IntelliJ IDEA its own build system?
In addition, what is the difference between run in IntelliJ and Gradle bootRun?
Build project is IntelliJ's own build-in build mechanism, it simply compiles all modified and dependent files in the project.
However, it's a "plain vanilla" build. It doesnt do fancy things like creating artifacts, deploying to repositories, codegen from a wsdl - etc. That's what we use build automation tools for, and there are 2 of them (maven and gradle) in widsepread use.
Maven and gradle allow developers to set up a custom (and more complex) build configuration.
The maven pom.xml defines lifecycle goals and the gradle build.gradle defines tasks.
Via a plugin architecture, maven / gradle can accomplish almost anything in a build process. Whilst the maven / gradle "run" task can operate similarly to IntelliJ "Build Project", it's not the same thing - in this case the build is instrumented by the build tool (maven or gradle) and can be configured differently, and be part of a more complicated build process.
What is difference build project in IntelliJ and gradle build?
IntelliJ build uses IDE's own jps project model and builder for compiling the java-based projects. Including incremental build support.
With Gradle build it actually uses Gradle to build the project (think Gradle build task).
In addition, What is difference run in IntelliJ and gradle bootRun?
Basically same as above: IntelliJ runner - uses build results of IDE's builder and IDE's own Run/Debug Configuration to launch the application ant tests. With Gradle runner - IDE delegates this to corresponding (bootRun) Gradle task.
See also Configure the build and run actions for additional details.
I tested this locally in my project, using two builds: one using IntelliJ IDEA's "build project" and the second using Gradle's own build command.
Then I checked the contents of the .build directory in my project and found that the former (IntelliJ IDEA's build) produced less files than the latter (Gradle). I think Gradle's build system is more powerful than IntelliJ IDEA's, which is why I prefer to use Gradle in my projects.

Converting an Eclipse Java project into an SVN project?

So I am trying to do something slightly unusual.
I checked out a project using Tortoise SVN, and then I imported that project into Eclipse as a Java project, and I can build the project fine.
But I would much rather use Eclipse's Subversion plugin than Tortoise SVN to check in files, update, compare diff's etc.
So is there any way I hook that Java project back into SVN in Eclipse, and then be able to check in files etc through Eclipse.
Note that checking out the project again using Eclipse is not an option for a few different reasons.
Thanks.
Right click on the Project and select 'Team > Share Project...' to set up SVN on the project.

delete eclipse project using ant

do somebody know how to delete eclipse project using ant?
I'm using eclipse in silent mode, to run ant build scripts and before build I'd like to delete 2 project which are generated automatically by eclipse. Is there any option? (Something like <eclipse.deleteProject />)
thanks in advance
There's nothing eclipse exposes by default to ant, AFAICT. I'd use ant to delete the folder (as suggested) and then use the eclipse.refreshLocal task on the workspace root. For what eclipse does expose, see Ant tasks provided by the platform.

Compiling Groovy Code in my Java EE application

My web project includes Groovy class files.
How should I compile it for my project using Eclipse?
Rest of my team is using IntelliIDEA to use it but I want to set it up in Eclipse.
To start with I have installed a Groovy Plug-In for my Eclipse and installed Groovy on my Windows.
You should be able to right click on the project -> Configure -> Convert to Groovy project.
If your project is a maven project, then you should also install m2eclipse as well as the optional m2eclipse configurator for groovy-eclipse. This will automatically configure your project for Eclipse and groovy.
Hope this links helps you. It has step by step on how to import your existing Groovy Project into eclipse so you can work on it.
http://docs.codehaus.org/display/GROOVY/Create+Your+First+Groovy+Project
If the project is created using grails create project, I believe all of the .project and .setting files are there for eclipse.
If you have the groovy eclipse plugin installed you should be able to mix your groovy classes into the same packages as your java code. Are you using maven or ant to build your actual war file? If not you will have to make sure that you compile the groovy classes along with the java code. while in eclipse you will be fine. Both ant and maven have facilities for compiling the groovy and java code together for your actual war that you deploy.

Eclipse m2eclipse clean, build projects, build automatically commands, what are they?

What is the command that m2eclipse runs when you
highlight a project -> Menu Project -> Clean -> Select anything -> Ok ?
It then goes on to "Building Workspace".
What is the command that allows it to do so?
The reason I am asking is that I am trying to do this from outside Eclipse, from the command line. I am trying to automate all maven stuff in a Groovy script. I am on Windows xp.
EDIT:
Also, the command update maven dependencies would be nice to have as well.
Thanks!
Maven-invocations are put in the Run and Debug menus. Just building the workspace does not run maven - it just does all the work Eclipse needs to do to know your files.
For your purposes these will suffice for the command line build:
cd /to/where/pom.xml/is
mvn clean
mvn install
No commands are directly run. Instead, the m2e plugin uses the configuration in the pom to create equivalent configurations in eclipse.
For example, if you change the source directories it will update the eclipse source directories for the java builder. If you change the target directories for the source compilation, it'll ensure that when you do a Project -> Clean, the plugin knows which directories to clean.
If you are trying to do this though a scripting language, I would recommend just running commands on the command line. The alternative would be to add the maven libraries to the classpath and to use them.

Categories

Resources