I've inherited a web project (Servlets) which is currently build inside eclipse.
I want to add maven around it. But the project's source directory is not following the maven convention. Instead of being inside src/main/java, it's src/package/name/...
I don't want to change anything right now because they are working at full speed towards a milestone. Can I configure maven to accept src/ as the java source directory ? Thanks
Source Directories The Maven property ${project. basedir} defaults to the top level directory of the project, so the build directory defaults to the target directory in project base dir. It also sets the property ${project.
Maven - Directory Structure (Project)the src/main/resources directory contains the project resources, the src/test/java directory contains the test source, the src/test/resources directory contains the test resources, the target/classes directory contains the compiled classes.
The target folder is the maven default output folder. When a project is build or packaged, all the content of the sources, resources and web files will be put inside of it, it will be used for construct the artifacts and for run tests.
The target directory is used to house all output of the build. The src directory contains all of the source material for building the project, its site and so on. It contains a subdirectory for each type: main for the main build artifact, test for the unit test code and resources, site and so on.
Just add this to your pom in the build
section.
<sourceDirectory>${basedir}/src</sourceDirectory>
Here's the relevant section of the POM doc on configuring the directories.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With