Tycho projects without Java code have Java nature in Eclipse - eclipse

I have imported my Tycho project in Eclipse using m2eclipse and I have the following issue: Tycho adds the Java nature to eclipse-plugin projects that don't have any Java code, for example the help plugin. It's not a big deal, but I find it annoying.
Is there any way to disable this?

Tycho doesn't define a separate packaging type for Eclipse plug-ins without code.
So if the Tycho Project Configurator, i.e. the m2eclipse extension for Tycho, wanted to omit the Java nature for eclipse-plugin projects, it could only do so after scanning the entire project for *.java files. And even then it would not be clear if the project does not contain Java code, or simply not yet contain Java code.
So, having the Java nature on all eclipse-plugin projects is a simple and robust choice that makes sense IMHO.

Related

How to maintain JAVA projects irrespective of IDE (Netbeans and Eclipse)

In my team, some of them are using Netbeans and some of them using Eclipse, so in our Subversion repository for each JAVA project we have Netbeans & Eclipse project files.
I do want to keep Netbeans & Eclipse project setting files inside the JAVA project, they are specific to IDEs.
Please help me to maintain only the JAVA source files inside the subversion.
Use a common build infrastructure, like maven. This encapsulates (as good as) all settings inside the maven pom.xml files (source encoding, java version etc.).
Also versioned library dependencies, subprojects are managed in maven.
NetBeans knows maven out-of-the-box, and eclipse has a good maven plugin.
In my experience manual configuration, especially in eclipse, and grown ant scripts, are cumbersome.

Working with a Scalatra application in an Eclipse workspace? (i.e. build path)

I am experimenting with a small Scalatra web application, which I have imported as a project into Eclipse.
I have used Eclipse to manage a few Lift applications before. With a Lift project, SBT copies all the dependency JAR's to a /lib_managed directory. I can therefore add those JAR's to Eclipse's build path, and it co-exists with SBT just fine without complaining about missing classes.
With Scalatra, however, the dependency JAR's don't seem to get copied anywhere helpful during the development cycle. If you build a WAR file, then the dependencies get bundled up into that... but there doesn't seem to be anything like Lift's /lib-managed directory.
Assuming that anyone else uses Eclipse in developing Scalatra projects, how might I easily set up Eclipse's build path? I suppose that I could manually create entries that point my local Ivy repository one-by-one, although that seems a bit ugly. Perhaps there's an easy way through SBT to setup something similar to Lift's /lib-managed subdirectory inside the project directory.
It looks like the best approach for this is using the SBT plugin for Eclipse.
This is not an "Eclipse plugin" for managing SBT. Rather, it's an "SBT plugin", for generating the .project and .classpath files used by Eclipse. The Maven world used to deal with Eclipse in a similar manner, before the m2eclipse Eclipse plugin reached maturity over the past couple years.
With this plugin installed (I installed it globally so I wouldn't have to change my project's files), you just type sbt eclipse after any changes to your dependencies. SBT will then update your Eclipse project files to match.
You could also use my Maven prototype, then simply import the maven project into Eclipse. Quite nice and you're not forced to use SBT.
https://github.com/fancellu/scalatra-maven-prototype

Eclipse project structure ANT and MAVEN

I am trying to set up a project, but feel completely overwhelmed with lack of knowledge. In university we used netbeans which resolved project structure gently for us. As community leans towards eclipse I am trying to migrate there, but feel myself like a penguin not able to fly. I can't understand project structure where and what has to be added, do I have to define ANT or MAVEN manually in eclipse can they be integrated? Where to go ? Apache manuals are so complicated, why is that I can program in Java , but don't know the fundamentals, soo depressed, please anyone guide me. I find pieces on web, but seems can't build full picture in my head.
You have a couple of options. Basically, eclipse uses a workspace, which contains one .metadata directory used by the plugins and all of the project folders. Projects can then be things like java projects, PDE projects, PHP projects, etc.
There is maven integration in eclipse which I would use, http://www.eclipse.org/m2e/ It was part of Indigo, which released June 2011.
Set up your java projects in your workspace, and then use m2e to mavenize them, or use m2e to generate the java projects into your workspace.
maven provides a facility to create a new project with the required structure based on the type of project (jar, war, etc.).
You can do this or achieve it directly from Eclipse as suggested by Paul Webster, by installing the m2e plugin.
This structure can then be easily built using maven, as well as developed in Eclipse.

Is there any way to avoid Scala libraries appearing twice in an Eclipse/Scala/Maven project?

I have
Eclipse 3.5.2
Scala 2.8.0 final (inc latest Scala IDE for Eclipse)
Maven integration for Eclipse
Maven 2.2.1
.project and .classpath files generated by maven-eclipse-plugin
I'm using Scala to write Specs BDD tests for my Java code and the setup above is working very nicely so far. However, I have one puzzling problem and I would like to know whether anyone knows how to resolve it.
The Scala libraries are appearing in my project twice.
in the M2 ClassPath (as a Maven Dependency)
as an Eclipse System Library (in the same manner as the JRE System Libraries)
Consequently, when I Ctrl-Shft-T every Scala class appears twice.
Can this be avoided without breaking my Scala project in either the command line or the Workspace?
The best place for questions like this is the Scala IDE user mailing list.
The most up to date documentation on using the Scala tooling for Eclipse with Maven via m2eclipse can be found here.
To answer my own question,
it appears (as hinted at by all above) that maven-eclipse-plugin is essentially obsolete. When I
deleted my old eclipse project
removed all eclipse files (ie .settings and .project from my project directory)
removed all references to maven-eclipse-plugin from my pom
installed the m2eclipse-scala plugin
re-imported the project as a maven project
all settings were detected correctly and I no longer saw the double entry of scala classes in my classpath.

synchronising / maintaining ant and eclipse classpaths

I'd be interested to find out about any automated processes that people have for ensuring that the project classpaths for the ant and eclipse configurations are in synch. In my case, I want the classpath defined in the ant build file to be the master configuration, since its used for our production builds. As part of the build i'd like to add an ant target that will verify that the eclipse classpath is up to date, or at least indicate differences between the two classpaths.
I'm aware of ant4eclipse but its focus is in the opposite direction, ensuring that the eclipse classpath is master and that the ant build reuses the eclipse path. I like the idea behind AntAndEclipse but am wondering are their ant other tools in this space that i'm not aware of.
You solution at a previous company was to have ant invoke Eclipse to do the compiles as described here:
http://www.eclipse.org/articles/Article-PDE-Automation/automation.html
I'm not aware of any ant tools which can do this but I've switched from ant to Maven a few years ago and never looked back. You can use the "Maven integration for Eclipse" to make Eclipse use the Maven classpath.
As of today, I'm not 100% happy with the Eclipse plugin, though. It's a bit slow and due to the different philosophy of Eclipse and Maven, some operations behave strange. For example, Eclipse doesn't differentiate between a "production" and "test" classpath, so you can get compile errors in Maven when everything looks great in Eclipse.
My solution was to use the plugin to keep the classpath in sync and compile from the commandline.
there is an ant task to do xml transformations, we used that task to create the classpath in our build file. It was a little trick to get the XSL right but once it worked it was great
Did you evaluate Apache IVY? Currently I am building a Continuous Integration environment at our place and we use IVY to handle our dependencies. There is a eclipse plugin that takes the dependency configuration of eclipse and uses it as eclipse classpath.
Currently this solution looks quite promising.
My team wrote an Eclipse plug-in to add a new type of library to the Java Build Path->Add Library option in the project settings. This custom library type allowed both Eclipse and ANT to reference the same canonical list of dependencies.
Nowadays, I'd probably look at IVY for doing the same thing if I was locked into using ANT, rather than writing my own.
You need Ant2Eclipse.