How to customize maven project structure

I know that usually the maven structure looks like this:

pom.xml src - main - web - WEB-INF 

However, I have a project that has the following structure

 src - main web - WEB-INF 

The last of the two above does not currently use maven. I started using maven for this project locally, creating a structure that conforms to the maven standard. However, now I want to automatically create this project with jenkins by pulling it from the original control (svn). So I would just like to add pom.xml, which knows that the web not inside src

Can this be done with maven?

+4
source share
2 answers

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

Here's how you 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 maven-jetty-plugin will not start out of the box. By default, it will look in src/main/webapp , so it must be configured.

You may not use the maven-jetty-plugin , but you will get this idea.

+5
source

Using the properties of the maven war plugin, you can set the warSourceDirectory property http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html (I don’t know exactly what problems you're having, so that this may or may not solve your specific problem).

However, maven is very self-confident, and I highly recommend using the expected maven structure. Other plugins can give you unexpected problems in the future, and maven’s life is usually much easier when you follow their conventions.

+3
source

All Articles