Maven 3.0.3原型创建:来自多个模块项目 [英] Maven 3.0.3 archetype creation: from multiple module project
问题描述
我正在使用Maven 3.0.3,并且我有一个要用于创建原型的多模块Maven项目.结构就像:
I am using Maven 3.0.3 and I have a multiple module maven project which I want to use for Archetype creation. Struture is like:
Main_Project
----pom.xml
----Module_1
----pom.xml
----src
----main
----java
----com
----mycompany
----domain
----DomainT.java
----repo
----resources
----webapp
----test
----Module_2
----pom.xml
----src
----main
----java
----com
----mycompany
----web
----WebT.java
----resources
----webapp
----test
现在,当我在Module_2中使用以下cmd时,原型将成功正确创建,即
Now, when I use the following cmd in the Module_2, archetype is created successfully and correctly i.e.
c:\Main_Project\Module_2>mvn archetype:create-from-project
但是,当我从主文件夹(即c:\Main_Project
)运行相同的命令时,未创建包结构(用于生成" cmd),并且两个模块中仍存在原始包结构.我的意思是用正确的变量替换了Java和其他文件中的软件包名称,但是未创建软件包文件夹结构.
But, when I run the same command from the main folder (i.e. c:\Main_Project
), the package structure is not created (for 'generate' cmd) and still the original package structure exists in the both the modules. What I mean is the package name in java and other files gets replaced with correct variables but the package folder structure is no created .e.g.
原始结构为:
----src
----main
----java
----com
----mycompany
----domain
----DomainT.java
运行cmd之后,mvn archetype:generate -DarchetypeCatalog=local
Define value for property 'groupId': : com.sample
Define value for property 'artifactId': : test_project
Define value for property 'version': 1.0-SNAPSHOT:
Define value for property 'package': com.sample: :
在Module_1\src\main\java
文件夹内部生成时,文件夹结构仍然与上面的相同(即Module_1\src\main\java\com\mycompany
),而不像Module_1\src\main\java\com\sample
Still the folder structure when generated inside the Module_1\src\main\java
folder is same as above (i.e. Module_1\src\main\java\com\mycompany
) and not like Module_1\src\main\java\com\sample
不确定如何使它正常工作吗?
Not sure what I can do to make it work?
推荐答案
现在已修复.
在父pom.xml中,模块声明位于配置文件中.
In parent pom.xml, the module declaration was inside profiles.
这篇关于Maven 3.0.3原型创建:来自多个模块项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!