edjm
edjm

Reputation: 5522

Can files outside of the Maven folder structure get compiled?

We have a Java project that was modified about 2 years ago based on the dates. The project uses a the Play Framework which as I recalled built and ran just fine back in 2012. The developer apparently had tried to change the project to be a Maven project but the folder structure is all over the place and not within the Maven src folder structure. Attempting to run the Play commands does not work on building the project any longer and using the Maven commands does not compile the code. What occurs is just the packaging of all of the folders and source code into a .jar file.

So the question is 'Can files outside of the Maven folder structure get compiled?' if so how, OR do I need to restructure all the code to be placed into the proper Maven folder structure to try and get this to work again?

Thanks for your time.

Rough view of the folder tree below: Unable to post the POM as it is on another system


Upvotes: 4

Views: 2383

Answers (1)

Laurentiu L.
Laurentiu L.

Reputation: 6686

Yes you can compile files in a non-standard Maven folder structure. Maven natively supports multiple source directories for the purposes of generated sources.

Read the Maven use guide When You Can't Use the Conventions

Using Multiple Source Directories This occurs when you are producing a single JAR (or other artifact), and have several source directories with classes you want to include.

This answer shows how to edit the directory structure in Maven by specifying the appropriate properties to override from the superpom.

The Maven pom docs show the build element set mentioned in the link above.

As a side note this answer covers a non standard directory layout for building war.

Upvotes: 3

Related Questions