简体   繁体   中英

How can I launch my Angular 5 web application with maven?

1.) I started with a spring boot/maven project.

2.) I added Angular 5 files into the project.

3.) I tested that I could build the project via the command line using node, bower, and gulp.

Currently in my pom.xml I am importing the following:

     <plugin>
            <groupId>com.github.eirslett</groupId>
            <artifactId>frontend-maven-plugin</artifactId>
            <version>1.6</version>
            <executions>
                <execution>
                    <id>install-node-and-npm</id>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>install-node-and-npm</goal>
                    </goals>
                    <configuration>
                        <nodeVersion>v8.9.1</nodeVersion>
                        <npmVersion>5.5.1</npmVersion>
                    </configuration>
                </execution>

                <execution>
                    <id>npm install</id>
                    <goals>
                        <goal>npm</goal>
                    </goals>
                    <!-- Optional configuration which provides for running any npm command -->
                    <configuration>
                        <arguments>install</arguments>
                    </configuration>
                </execution>

                <execution>
                    <id>npm run build</id>
                    <goals>
                        <goal>npm</goal>
                    </goals>
                    <configuration>
                        <arguments>run build</arguments>
                    </configuration>
                </execution>

                <execution>
                    <id>bower install</id>
                    <goals>
                        <goal>bower</goal>
                    </goals>
                    <configuration>
                        <arguments>install</arguments>
                    </configuration>
                </execution>

                <execution>
                    <id>gulp build</id>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>gulp</goal>
                    </goals>
                    <configuration>
                        <environmentVariables>
                            <NODE_ENV>prod</NODE_ENV>
                        </environmentVariables>
                    </configuration>
                </execution>

            </executions>

        </plugin>

-After I build my application using 'mvn package install', the build is successful. However my application is not running.

QUESTION: How do I see my application? Do I need to configure something else or add something else to my pom.xml?

In this video, I was showing how to deploy an Angular app under the Spring Boot server: https://youtu.be/k8r76d8QzXs?t=2237 .

Each time the Angular app changes, just re-run the npm run build command to deploy the new version of Angular bundles under the Spring Server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM