0

I would like that the JAR build-path (or jar files in the build-path) of and eclipse project pointed to a local directory into eclipse project named "lib", not pointed to M2_REPO variable (my maven local repository path)

In lib directory, there are jar files copied through overriding 'copy-dependencies' goal in 'mave-dependency-plugin' My intention is that eclipse project were self-contained.

I tried overriding goals configure-workspace and from maven-eclipse-plugin, but it don't works.

¿is there way for to do this?

Aleamb
  • 33
  • 1
  • 7

2 Answers2

1

Sure you can override the .classpath generated using the maven-eclipse-plugin

  <plugin>
    <artifactId>maven-eclipse-plugin</artifactId>
    <version>2.8</version>
    <configuration>
      <wtpversion>1.5</wtpversion>
      <packaging>war</packaging>
      <wtpContextName>${project.artifactId}</wtpContextName>
      <buildOutputDirectory>WebContent/WEB-INF/classes</buildOutputDirectory>
      <additionalConfig>
        <file>
          <name>.classpath</name>
          <content><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<classpath>
  <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
  <classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/project-lib"/>
  <classpathentry kind="output" path="WebContent/WEB-INF/classes"/>
</classpath>]]></content>
        </file>
      </additionalConfig>
      <buildcommands>
        <buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
        <buildcommand>org.eclipse.wst.common.project.facet.core.builder</buildcommand>
      </buildcommands>
    </configuration>
  </plugin>
shyam
  • 9,134
  • 4
  • 29
  • 44
  • It is a possible solution, but problem is that are many dependencies. I have to write many and is hard to manage too. Write kind="con" path="lib" doesn't work. – Aleamb Oct 16 '12 at 11:25
0

I suggest to try one of the following ways:

  • Use a Maven Repository Manager such as Nexus and deploy any jar you have which are not in an available repository. Then use "normal" Maven dependencies.
  • Use system Maven dependencies.
Puce
  • 37,247
  • 13
  • 80
  • 152
  • I want to avoid writing in each depedency. Although it is unique solution surelly – Aleamb Oct 16 '12 at 11:44
  • Why do you want to avoid it but at the same time have something similar using the maven-eclipse-plugin? Note that I'm not sure that using the maven-eclipse-plugin to add dependencies will work anywhere but in Eclipse (and you might want to build your projects on a continuous integration server). – Puce Oct 16 '12 at 12:05
  • I think you're right. I will use systemPath. I hope there will not problems. I must use self-contained eclipse project due client policies. There aren't continuous integration requisites in this project. Thanks. – Aleamb Oct 16 '12 at 13:42