0

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?

user2166888
  • 579
  • 1
  • 5
  • 13
  • "When to use/not to use" is to broad because a correct answer would need to list all potential use cases. The question "why do we need a plugin" at all is valid - but expecting answers beyond that is just expecting others to do the basic research for you. – oberlies Jan 07 '15 at 15:09

2 Answers2

2

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.

Holly Cummins
  • 10,767
  • 3
  • 23
  • 25
  • `@holly` thanks for your reply. I have a quick question. I already have m2e plugin in my eclipse. when i check out a maven project from SCM (basically clone my GIT repository), eclipse at the end of clone process prompts me to install Tycho Project Configuratiors. I read that Tycho builds eclipse plugin with maven. If I skip the step and do not install tycho, will eclipse with m2e plugin and m2e connectors still be able to compile my eclipse plugin and OSGI bundles with stand alone m2e plugin?? – user2166888 Dec 29 '14 at 22:45
  • `@holly` You mentioned above m2e and tycho both help us follow DRY principle. Assumption:- we can build eclipse plugins and maven bundles using m2e. So is there any advantage for using Tycho over instead of m2e to build eclipse plugin and OSGI bundles? I ask this question since Tycho website mentions main purpose of using Tycho is to build eclipse plugin and OSGI bundles. But they do not say why Tycho is better? – user2166888 Dec 29 '14 at 23:01
  • `@holly` I shall appreciate if you can have a look the following question i posted and if you can please provide me with your valuable insights. `Please click` [here](http://stackoverflow.com/questions/27697268/osgi-container-identification-equinox-knopflerfish-and-relation-ship-between-e) – user2166888 Dec 29 '14 at 23:24
  • is there any advantage by running tycho on top of m2e in a eclipse environment? – user2166888 Dec 29 '14 at 23:40
  • 1
    Both Tycho and m2e could be useful in building, but I wouldn't use them together. Eclipse PDE (plugin development environment) is designed to support a manifest-first style of development; you write down your dependencies in the manifest.mf, and Eclipse sorts out the classpath. With m2e, you're starting with the maven pom, and m2e works from that to make things work in Eclipse. So they're going in opposite directions. – Holly Cummins Dec 30 '14 at 07:23
  • 1
    You certainly could use just m2e to get your plugins compiling in Eclipse, so it's mostly a question of whether you want to do most of the build configuration in Eclipse and transfer to maven (Tycho), or start with maven and then use m2e to make things work in Eclipse. – Holly Cummins Dec 30 '14 at 07:27
  • `@holly` do you know any good articles or references to read about tycho and m2e. i googled a few articles but they are very concise and do not give much information – user2166888 Dec 31 '14 at 18:45
  • 2
    @user2166888 You may have found this one already, but http://www.vogella.com/tutorials/EclipseTycho/article.html is pretty comprehensive. Tim and I also have a section on Tycho (along with more general discussion of building OSGi projects) in Chapter 9 of [_Enterprise OSGi in Action_](http://www.manning.com/cummins/). – Holly Cummins Jan 05 '15 at 10:00
  • can you please take a look at at the following link-> `[click here](http://stackoverflow.com/questions/27804749/tychomaven-plugin-outofmemoryerror-eclipse-32bit-eclipse-luna-vs-64-bit-ecli)`. do we require different tycho version to run on 32 bit eclipse luna and 64 bit eclipse luna – user2166888 Jan 06 '15 at 19:17
1

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.

oberlies
  • 11,503
  • 4
  • 63
  • 110