如何配置自定义的Maven项目结构 [英] How to configure custom maven project structure

查看:140
本文介绍了如何配置自定义的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.

这篇关于如何配置自定义的Maven项目结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆