samedi 2 janvier 2016

Maven package 2 projects into a single war to deploy to tomcat server

I am trying to create a project that uses a java spring back-end and a javascript front-end. I have a parent pom with 2 modules 'webapp' and 'frontend'. how would i package this all into one war to copy onto a local tomcat server?


I know i would have to create one "uber" WAR but i dont know how to do that using maven, any pointers/ links to tutorials on packaging projects like this?

I dont want to put them into one EAR file.

Parent pom

<project xmlns="http://ift.tt/IH78KX"
     xmlns:xsi="http://ift.tt/ra1lAU"
     xsi:schemaLocation="http://ift.tt/IH78KX 
     http://ift.tt/VE5zRx">
    <modelVersion>4.0.0</modelVersion>

    <groupId>foo</groupId>
    <artifactId>barr</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.1.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-releases</id>
            <url>http://ift.tt/1A9iaEo;
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-releases</id>
            <url>http://ift.tt/1A9iaEo;
        </pluginRepository>
    </pluginRepositories>

    <modules>
        <module>webapp</module>
        <module>frontend</module>
    </modules>
</project>




Aucun commentaire:

Enregistrer un commentaire