Tycho build Cohabiting with Eclipse RCP - maven

The context: I have embraced Eclipse Tycho to automate the build of my small clutch of plugins. It does a great job. Part of the Tycho migration included removing all Eclipse .project and .classpath files from SCM.
The problem: To work on my plugins in Eclipse I must import my projects using "Import => Existing Maven Project", however the resulting Eclipse project has a very different shape:
It lacks any Eclipse plugins required to compile it
though my sources lie in the usual directory src/main/java the project is not configured use this as a source directory.
My question: How can I build a .project and .classpath combination that will get me back to pre-Tycho IDE productivity.
I have tried mvn eclipse:eclipse which says "eclipse-plugin" no longer supported, but does Tycho have something similar that is?
mvn clean install builds successfully

In retrospect the solution seems obvious, and my many thanks to oberlies for the clue.
To develop Eclipse plugins you must be using the Eclipse RCP/RAP edition or the Maven/Tycho import will not prompt you to install the Tycho configurator that maps the Maven project back into an Eclipse RCP project.
Repeating the steps outlined in my question, using "Eclipse for RCP and RAP Developers" prompts the developer to install the configurator, after which Eclipse requires a restart, and leaves perfectly useful RCP plugins projects.
M.

Related

Having Maven Plugins in IntelliJ IDEA without Maven Installation in Computer

I just started to use Maven and IntelliJ IDEA.
I imported a project into IntelliJ IDEA which requires Maven. I didn't install Maven to my computer but I have 2 plugins in IntelliJ IDEA named as "Maven" and "Maven Extension". And the code I have is running without any dependency problem.
In that case, do I still need to install Maven from the web or just the plugins in the IntellJ are enough for projects with Maven?
Can we say that for every project? If someone can explain the logic behind I would be very happy.
Thanks a lot!
Intellij comes with a bundled version of Maven (see File -> Settings -> Build, Execution, Deployment -> Build Tools -> Maven; the property 'Maven home directory' on that screen by defaults points to 'Bundled (Maven 3)').
You don't have to, but you can still install your own version of Maven, and point that property to it. It has the advantage of being able to run maven from the command-line, which is a better guarantee of build-stability (i.e. building the same project in different environments with the same result) than building directly inside of your IDE. And often is way more helpful in investigating build problems.

Maven plugin Tycho -> when to use it and when not to use it

What is the purpose to use Maven Tycho plugins. I read here tycho is used for building eclipse plugins and OSGI bundle.
Questions:- Can not we build eclipse plugins and OSGI bundle just by using the plain old maven POM.xml file[by not using tycho plugin].
What does maven need tycho plugin to help it build eclipse plugin and OSGI bundles?
Why should we use Maven tycho plugin to build eclipse plugins and OSGI bundles?
When using maven (or other command line build tools) manifest.mf) in combination with Eclipse (or another IDE) the classpath ends up being written down twice - once in the pom.xml and once in the Eclipse .classpath (or, for OSGi, in the target platform and manifest.mf). This violates the DRY principle.
There are various solutions to this problem. One is something like m2e, where you use the pom.xml to generate the Eclipse .classpath. Alternatively, you can go in the other direction and start by getting things compiling in Eclipse, and then use a maven plugin to convert that Eclipse setup to a maven build. This is what Tycho does, with the extra wrinkle that it works from a PDE manifest + target platform rather than directly from the .classpath.
Maven doesn't have a built-in packaging type for OSGi bundles and/or Eclipse plugins. So unless you want to use the jar packaging type and manually add OSGi specifics, you need a Maven plug-in to help you with this.
Tycho is one of the plugins that add support for building OSGi bundles.

run maven project with eclipse

I'm new to maven and eclipse. I added m2e-plugin in eclipse and I imported an example of a maven project that I've found in the net.
My problem is when I try to run the project in eclipse using the Run as item menu, I don't find the maven package menu as I learned in the different tutorials.
Is it a problem of installation?
Ok, lets go through this step by step to make sure you have everything you need to get going.
First of all make sure that you have Maven installed (and lets assume you have Java already). You can download it from http://maven.apache.org/download.cgi and installation instructions for Fedora (which I assume is what you are using from your tag) are further down the page.
To test that Maven is correctly installed and working type mvn --help in to the terminal. Eclipse and m2e pretty much just hop on to the terminal for everything Maven related so make sure this is working before proceeding.
Next download an appropriate version of Eclipse. For the sake of this example I've downloaded the Kepler version of the Java EE IDE. In this version of Eclipse m2e comes bundled and to check this you can go to Help > About Eclipse > Installation Details and on the plug-ins tab you should see the m2e connectors.
Now you can import your Maven project in to Eclipse. To do this go to File > Import and then choose Existing Maven Projects under the Maven section. Choose the directory with the example project that you've downloaded and then Finish.
Now, ensure that you have some file inside your example Maven project opened and when you go to Run As... you should now be able to see the maven options. Go to Run As > Maven build... and all you need to do is place the word package in the Goals field and you're ready to roll.
Convert your project to a maven project if you haven't done yet by right clicking on your project in the Eclipse Project/Package explorer. Then follow:
Configure -> Convert to Maven Project
After that you can just right click again on the project Run as and you will see all Maven possibilities to execute your project build/install/clean etc.

how to build and deploy sakai cle 2.9.x in eclipse

I have imported "sakai" project into eclipse.
How do I build and deploy automatically in "Sakai 2.9.x" in eclipse?
Building from within eclipse is not recommended. We would suggest that you build from the maven command line. However, I think this is answered here: How to build and run Maven projects after importing into Eclipse IDE

how to auto build jar by maven when i modify one java class?

I have install m2eclipse plug-in for eclipse. I built a multi-module project by maven, each module are dependent, when i write a class,the eclipse can't automatically compile the class to jar file and install to M2 repository,i need to run MVN install command, then other modules can be reference the jar file, this is too much trouble, is there any good way to solve this problem?
This is because the "install" phase does not belong to m2eclipse's interesting lifecycle phases. In short, Eclipse and Maven build cycles differ a lot, and m2eclipse has a map that binds particular phases — and "install" is, by default, not mapped.
This map can be, however, configured in the POM of your project (ideally, the main POM). See: M2E_plugin_execution_not_covered

Resources