0

I use Maven and I have two different scenarios , and in both of them I want to have the jar built from Maven pom.xml to include all the dependencies.

  1. I have an eclipse buildpath dependency on Maven project B from Maven Project A , when I build Maven project A I want to include project B jar included in it , how can I do that ?

  2. Maven project B also has a lib folder that I added to have a custom jar that is not available in any maven repository , I want this jar to also be included when project B is built by itself using its own maven pom.xml .

How can I achieve these two scenarios. Any guidance would be greatly appreciated.

Thanks.

Dennis Kriechel
  • 3,719
  • 14
  • 40
  • 62
user1965449
  • 2,849
  • 6
  • 34
  • 51
  • How do you want ProjectB included in projectA? And what kind of project are you building? How will you use the jar you are creating? – Behe Jul 05 '13 at 18:51
  • I want Project B to be included in Project A as a jar so that I can run the Project A jar as a java application , both Project A and Project B are java projects. – user1965449 Jul 06 '13 at 21:02

1 Answers1

1

I'm not sure about your question 1, but if I understand it correctly, you would like to build with Eclipse two Maven projects where A depends on B? Then you may use an Eclipse plugin like m2eclipse.

For your second question, I think the solution would be to use the system scope for your dependency that you can't find in any public repository. Of course, if you can deploy the dependency on an entreprise repository it would be better.

Community
  • 1
  • 1
LaurentG
  • 11,128
  • 9
  • 51
  • 66
  • The linked question advises to *not* use the _system_ scope. [The maven documentation](http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#System_Dependencies) tells that "Dependencies with the scope system are always available and are not looked up in repository. They are usually used to tell Maven about dependencies which are provided by the JDK or the VM.". So for a custom jar, _system_ isn't the appropriate scope. – Behe Jul 05 '13 at 20:17
  • I agree. But the *system* scope can be useful especially with legacy system. – LaurentG Jul 06 '13 at 10:30