0

When I use maven projects in eclipse they automatically manage dependencies. That is - if the project A is imported to eclipse, all other projects using A have the project itself in "build path" instead of the artifact.

This makes changes done in project A instantly visible to e.g. unit tests in other projects.

I have a maven project B depending on gradle project A. How to replicate this behaviour? Currently I need to rebuild B (and deploy to local maven repo) whenever I change it.

mabn
  • 2,473
  • 1
  • 26
  • 47
  • There is a support for opposite direction: if a Gradle project depends on an artifact produced by Maven project opened in Eclipse the plugin provided by SpringSource/Pivotal will use project dependency rather than binary dependency. – Radim Nov 13 '14 at 16:45

1 Answers1

1

I assumed you tried the Eclipse gradle feature by Spring Source(not the gradle eclipse plugin)? Regardless I doubt you will be able to get the same behavior as Maven to Maven with Maven to Gradle as that would be two different eclipse plugins (m2e and eclipse-gradle).

What I have seen many Gradle users do is have a Maven pom file with all the dependencies in their Gradle projects. They then just use the M2Eclipse plugin as though the project was just an Maven project but use Gradle for building on the command line.

You can create the POM file with Gradle itself.

What I do myself is just recompile and install (ie mvn install). Yeah its annoying but it actually forces me to write more unit tests and keep the projects more SOLID, higher cohesion and lower coupling. If your changing two projects constantly this could be signal for bad design (not always).

Community
  • 1
  • 1
Adam Gent
  • 47,843
  • 23
  • 153
  • 203