How to configure custom maven project structure

build, java, jenkins, maven

Solution

You can configure the `maven-war-plugin` to use another `warSourceDirectory` but as Jeff Storey explains in his answer it is really not recommended.

This is how you would do it:

<project>
    ...
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <warSourceDirectory>web</warSourceDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>
    ...
</project>

One of several problems is for example that the `maven-jetty-plugin` will not run out-of-the-box. It will by default look in `src/main/webapp` so that has to be configured.

You might not use the `maven-jetty-plugin` but you get the idea.

Problem

I know that typically maven structure is like this: ``` pom.xml src - main - web - WEB-INF ``` However, I have a project which has the following structure ``` src - main web - WEB-INF ``` The latter of the two above currently does not use maven. I've started using maven for this project locally by making the structure conform to the maven standard. However, I now want to automatically build this project from jenkins by getting it out of the source control (svn). So I would like to just add a pom.xml which is aware of the fact that `web` isn't inside `src` Is this possible to do with maven?

Original source