MAVEN Archetype choosing

懵懂的女人 提交于 2020-01-04 04:35:29

问题


Hi i am just new to maven. My requirement is to build a ear with 2 wars and also create a jar. I tried using some archetypes but few folder structure are missing. My maven folder structure should contain src/main/ java resource webapp test/java test/resource. Which archetype will be a suitable?


回答1:


You cannot have it in single project, Since the EAR consists of different modules.

So create separate project for war, jar and build.

To create war file use maven-archetype-webapp, and for jar use maven-archetype-quickstart.

Then include those project module in main project pom file with module

Eg

<modules>
    <module>expLogdao</module>
    <module>expLogservice</module>
    <module>expLogweb</module>
    <module>expLogear</module>
</modules>

Then use separate project to build ear

Now include all project modules in ear project dependencies tag

    <dependency>
        <groupId>com.expLog.service</groupId>
        <artifactId>expLogservice</artifactId>
        <type>jar</type>
        <version>0.0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.expLog.dao</groupId>
        <artifactId>expLogdao</artifactId>
        <type>jar</type>
        <version>0.0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.expLog.web</groupId>
        <artifactId>expLogweb</artifactId>
        <type>war</type>
        <version>0.0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>



回答2:


Because of the formatting of the question it is a little tough to see what exactly you want.

Have you looked at org.apache.maven.archetypes.maven-archetype-webapp?



来源:https://stackoverflow.com/questions/10211552/maven-archetype-choosing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!