eclipse-january / january

January project
Eclipse Public License 1.0
34 stars 25 forks source link

Build January as a "pure" Maven project #165

Open jonahgraham opened 7 years ago

jonahgraham commented 7 years ago

To ease contribution and more easily manage builds we are considering changing January's build system from Maven+Tycho to "pure" Maven. This eases development of features such as #144 and opens up January for contribution from anyone more easily.

This discussion started on january-dev, the conclusions will be added here in due course.

erwindl0 commented 7 years ago

Here's a detailed report of setting up a January development environment in IntelliJ IDEA community edition, starting from the January master state of April 16th.

I'm on a Windows 10 with a 1.8 JDK.

The result of what I've been trying is on the branch https://github.com/erwindl0/january/tree/erwin/enh/165/january-maven-non-eclipse for your review. Just let me know if/how you want to work with it or not!

Steps done to figure things out :

  1. fork to erwindl0 & clone locally
  2. create a branch
  3. Open Project... from root january folder (i.e. the cloned repo)
  4. let IntelliJ run a bit, importing stuff, loading plugins/deps etc (what is this?)
  5. projects visible but : 5.1 src folders not recognized, nothing is done in a build 5.2 when no src level is set, default 1.5 seems to be assumed (was also the case in Netbeans).
  6. Set a build>sourceDirectory>src in o.e.j.releng POM
  7. sources are recognized now, build errors because of 1.5 language level assumption and missing dependencies
  8. set Java level 7 in IntelliJ => does not create this in POM (contrary to Netbeans)! Just sets this in the .iml metadata file!
  9. add maven.compiler.source and ...target 1.7 properties in that o.e.j.releng POM
  10. add dependencymanagement section in o.e.j.releng POM for all 3rd party deps
  11. add dependencies in all the module poms (without version info, as that is then inherited from the dep-mgmt spec)
  12. examples & test projects have issues with level 1.7 (generic cast syntax with type token in method calls as described before) => set compiler props in POM + IJ module settings to 1.8
  13. finally, set tycho target config to pomDependencies = consider and remove target file from the spec
  14. try the mvn tycho build
  15. error from inside slf4j api : manifest has a dep on org.slf4j.impl 1.6.0 but this is not in their poms!
  16. add a hard dep on slf4j-simple 1.7.10 in o.e.j.releng POM
  17. then an error for Junit : the 4.12 taken from Maven Central is not an OSGi bundle, so does not export its packages etc. This causes errors when building e.g. the o.e.j.asserts project => we can not just build with maven deps from Maven Central
  18. Replace references to org.junit bundle by org.apache.servicemix.bundles.junit (to try out the other stuff, can not be kept like that!)
  19. Then there's a strange error for the releng.p2 Resolving step : stating that the o.e.j bundle can not be resolved as it can not find the o.a.c.lang bundle. Although the individual resolving of the o.e.j works fine, and the commons-lang 2.6 artifact in my local repo is a correct bundle !?!?
  20. Remove the releng.p2 module from the build and retry
  21. build works upto the examples project, where the tycho surefire fails as it apparently needs org.eclipse.osgi (which is not in the official/mvn standard dependencies)
  22. give up on getting the Tycho build working with only maven deps. So rollback 13, 16 and 18.
  23. now everything works well in IntelliJ and for a mvn clean install build.

Conclusion :

jonahgraham commented 7 years ago

Erwin, thanks for the detailed analysis. I have had a look at your fork and we will definitely want to pull some of that across.

a January consumer project may fetch deps from maven central that are not osgi bundles!

That is a very good point and an interesting problem. It sounds like I will need some more complete "post-install" tests to ensure everything continues to work. i.e. test running with and without OSGi that everything is pulled together OK.