How to create .war file using maven?

前端 未结 3 1453
挽巷
挽巷 2021-01-12 13:49

Here is my project consisting of the following maven modules:

model, services, web

Only web module war file is creating under target folder..web

相关标签:
3条回答
  • 2021-01-12 14:12

    I assume the web module depends on the model and services module. Then in the web module you should use packaging

    <packaging>war</packaging>
    

    which will create a WAR with everything in it. See War Plugin The created WAR contains its dependencies. You can not deploy the model or services projects alone.

    If your project already is packaged as war, check if JARs of model and services are inside the WAR/WEB-INF/lib folder. if yes everything is ok and the war is ready to be deployed.

    0 讨论(0)
  • 2021-01-12 14:12

    Her is what is should look like:

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-ear-plugin</artifactId>
                <configuration>
                    <unpackTypes>war</unpackTypes>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
    0 讨论(0)
  • 2021-01-12 14:14

    You need to set packaging at pom.xml

    <packaging>war</packaging>
    

    Than run the command:

    mvn install
    
    0 讨论(0)
提交回复
热议问题