Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to link source from outside of maven project?

Tags:

maven-2

In Maven, is it possible to link additional dependent java src from outside the project folders, so that when we build our main package, maven may include such classes into final jar?
just as we can link any source folder to our project in Eclipse and eclipse treats it as regular project source?

like image 394
WSK Avatar asked Nov 08 '10 15:11

WSK


People also ask

What is external dependency in Maven?

External dependencies (library jar location) can be configured in pom. xml in same way as other dependencies. Specify groupId same as the name of the library. Specify artifactId same as the name of the library. Specify scope as system.

Can we add external jar in Maven project?

Contrary to what people have said here, you can put an external jar in a folder under your checked-out project directory and haven Maven find it like other dependencies. Here are two crucial steps: Use "mvn install:install-file" with -DlocalRepositoryPath. Configure a repository to point to that path in your POM.


1 Answers

In Maven, is it possible to link additional dependent java src from outside the project folders

Technically, it's possible to add source folders to a build and this is usually done using the build-helper-maven-plugin. However, I would recommend against doing so for directories outside a given module, a maven module should be self contained.

like image 101
Pascal Thivent Avatar answered Sep 22 '22 18:09

Pascal Thivent