質問

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

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

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.

The original structure was:

     ----src
         ----main
            ----java
              ----com
                ----mycompany
                   ----domain
                     ----DomainT.java

After I run the 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: :

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?

役に立ちましたか?

解決

Fixed now.

In parent pom.xml, the module declaration was inside profiles.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top