Search code examples
eclipsemaven-2mavenm2eclipsemaven-3

automatic import of existing maven dependencies


I have maven dependency with available source code. Is it possible to import it as maven project in eclipse automatically?

I can manually create new maven project in eclipse, unpack source code in its source directory and pom file.

Are there any plugin or other tool that does such work?


Solution

  • Use the Maven Eclipse plugin and tell it to download sources and javadocs for you:

    <project>
      [...]
      <build>
        [...]
        <plugins>
          [...]
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.8</version>
            <configuration>
              <downloadSources>true</downloadSources>
              <downloadJavadocs>true</downloadJavadocs>
            </configuration>
          </plugin>
          [...]
        </plugins>
        [...]
      </build>
      [...]
    </project>