Announcement Announcement Module
Collapse
No announcement yet.
How to use "remap Jars to maven projects" feature Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use "remap Jars to maven projects" feature

    Hi,

    I'm using the eclipse-integration-gradle plugin and I want to know how does the "Remap Jars to maven projects" feature works (see the attached screenshot).

    Attachment

    Here is the original motivation for this question: http://stackoverflow.com/questions/1...gradle-project

    Thanks in advance,
    Attached Files

  • #2
    This info may be hard to find. Here is a link to a interesting comment in the original issue ticket about implementing this feature.

    https://issuetracker.springsource.co...#comment-67092

    Summary: for the feature to work you have to publish the jar at least once to some maven repo. This can be the local maven repository. I.e. unless gradle can resolve the jar as a maven style dependency then it won't work.

    Setup will be something like the following example. I'll include the full sample code in a zip attachement.

    It has two projects one callled 'main' and another called 'myLib'. Main depends on myLib. Main is a gradle project and myLib a maven project.

    In main/build.gradle you have something like this:

    Code:
    repositories {
        mavenLocal()
    }
    
    dependencies {
        compile group: 'com.kdvolder', name: 'myLib', version: '0.0.1-SNAPSHOT'	
    }
    In myLib/pom.xml something like this:
    Code:
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.kdvolder</groupId>
      <artifactId>myLib</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <name>myLib</name>
      <description>myLib</description>
    </project>
    Make sure to publish the jar at least once to your maven local repository by running something like 'mvn clean install' command in the maven project. Either on the commandline or via m2e tooling. It doesn't really matter.

    Verify that 'main' project
    - has 'Dependency Management' option enabled.
    - You have the 'remap ...' option enabled in the global preferences.

    Run a 'Refresh all' or 'Refresh Dependencies' command on 'main' from the Gradle context menu. This should update the dependencies in the project, replacing the jar dependency with a Eclipse project dependency.

    Further refreshes will maintain this project level dependency as long as the version number for 'myLib' in your project matches that in the gradle dependency.

    You don't have to refresh or republish anything if you make changes to 'myLib'.

    Comment


    • #3
      This is exactly what I was looking for. Thanks!

      Comment

      Working...
      X