如何配置自定义的Maven项目结构

如何配置自定义的Maven项目结构

问题描述:

我知道,通常的Maven的结构是这样的:

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

两者以上目前不使用行家后者。我使用maven这个项目在当地通过结构符合Maven的标准开始。不过,我现在想通过获取它的源代码控制(SVN)的自动建立从詹金斯这个项目。所以我想只要添加一个pom.xml是知道的事实,即网​​站不是在的src

这是可能的行家呢?

您可以配置的 Maven的战争插件 使用其他的 warSourceDirectory 但杰夫楼层解释了他的answer 它真的不推荐使用。

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

这是你会怎么做:

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

其中的几个问题,是例如在 Maven的码头 - 插件 不会出的现成运行。它将在默认外观的src /主/ web应用,这样必须配置。

您可能没有使用 Maven的码头 - 插件,但你的想法。

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