0

I'm converting a legacy Java project to Maven. It currently uses Ant, and has a structure like this:

src\mainProduct\com\mycompany
src\external\com\acme\...

Assuming I move everything under src\mainProduct into the Maven-structure (src\main\java), is there a way to include the external folder as an additional source directory without moving it? Alternatively, how do I move it under src\main\java\external, without changing the package names?

assylias
  • 321,522
  • 82
  • 660
  • 783
Igal Tabachnik
  • 31,174
  • 15
  • 92
  • 157

2 Answers2

0

Have a look here: http://maven.apache.org/guides/mini/guide-using-one-source-directory.html

So what you'd have to do is:

<build>
   <sourceDirectory>src/mainProduct</sourceDirectory>
   ...
</build>

Alternatively you could try and use the approach suggested here: Maven compile with multiple src directories
The build-helper-plugin and its documentation can be found here: http://mojo.codehaus.org/build-helper-maven-plugin/

Community
  • 1
  • 1
Thomas
  • 87,414
  • 12
  • 119
  • 157
0

if you move it, move it to src\external\java, that might be better suited than src\main\java\external. Maven compile with multiple src directories shows how to add additional source directories to be used by Maven.

Community
  • 1
  • 1
cello
  • 5,356
  • 3
  • 23
  • 28