改变一个Ant项目到Maven [英] Changing an ant project to maven

查看:722
本文介绍了改变一个Ant项目到Maven的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题很简单:有一种蚂蚁的项目,我的端口到Maven 。作为Maven有一个推荐/ 预计项目目录结构,如果我重整java文件的目录,这将大大牵连的手工工作。在另一方面,该项目也不会很满意这个解决方案,不提其他,使用当前项目的包。

你有什么想法, 怎么会是可能迁移到Maven而无需更改目录结构?也谢谢提前。


解决方案

我们强烈建议您使用Maven的标准目录结构,但你可以在你的POM中设置自定义src目录

。是这样的:

 <建立>
 < sourceDirectory>路径\\为\\实际的\\ src< / sourceDirectory>
< /构建>

下面可能是你在找什么:<一href=\"http://stackoverflow.com/questions/224373/handling-unconventional-source-directory-for-a-web-project-in-maven\">Handling在Maven的 Web项目非常规源目录

修改:下面是那些在Maven的超级POM设置,可以在您的项目的pom.xml被覆盖默认设置列表

 &LT;建立&GT;
    &LT;&目录GT;目标&LT; /目录&GT;
    &LT;输出目录&GT;目标/班&LT; /输出目录&GT;
    &LT; finalName&GT; $ {}的artifactId - $ {版本}&LT; / finalName&GT;
    &LT; testOutputDirectory&GT;目标/测试类&LT; / testOutputDirectory&GT;
    &LT; sourceDirectory&GT;的src / main / java的&LT; / sourceDirectory&GT;
    &LT; scriptSourceDirectory&GT;的src / main /脚本&LT; / scriptSourceDirectory&GT;
    &LT; testSourceDirectory&GT;的src / test / java下&LT; / testSourceDirectory&GT;
    &LT;资源&GT;
      &LT;资源&GT;
        &LT;&目录GT;的src / main /资源&LT; /目录&GT;
      &LT; /资源&GT;
    &LT; /资源&GT;
    &LT; testResources&GT;
      &LT; testResource&GT;
        &LT;&目录GT;的src /测试/资源&LT; /目录&GT;
      &LT; / testResource&GT;
    &LT; / testResources&GT;
&LT; /构建&GT;

The problem is quite simple: there is an ant project that I should port to maven. As maven has a recommended/expected project directory structure, this would implicate much manual work if I restructure the directories of the java files. On the other hand, the project would also not be very happy with this solution, not mentioning others, using the packages of the current project.

Do you have any idea, how it would be possible to migrate to maven without having to change the directory structure? Thank you also in advance.

解决方案

It is strongly recommended that you use Maven's standard directory structure, but you can set a custom src directory in your pom. Something like:

<build>
 <sourceDirectory>path\to\actual\src</sourceDirectory>
</build>

The following might be what you're looking for: Handling unconventional source directory for a web project in maven

Edit: The following is a list of default settings that are set in the Maven Super POM and can be overriden in your project's pom.xml

<build>
    <directory>target</directory>
    <outputDirectory>target/classes</outputDirectory>
    <finalName>${artifactId}-${version}</finalName>
    <testOutputDirectory>target/test-classes</testOutputDirectory>
    <sourceDirectory>src/main/java</sourceDirectory>
    <scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
    <testSourceDirectory>src/test/java</testSourceDirectory>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
      </testResource>
    </testResources>
</build>

这篇关于改变一个Ant项目到Maven的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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