SpringBoot整合Angular应用第二弹-配置支持Angular

上篇文章我们讲解了使用SpringBoot整合Angular的时候的基础环境的配置,我们这篇文章主要讲解让Angular去和SpringBoot进行整合操作.

  • 修改pom文件为以下内容
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.edurt</groupId>
    <artifactId>springboot-angular-integration</artifactId>
    <packaging>jar</packaging>
    <version>1.0.0</version>
    <name>springboot-angular-integration</name>
    <url>http://maven.apache.org</url>
 
    <properties>
        <system.java.version>1.8</system.java.version>
        <!-- node & npm -->
        <system.node.version>v8.2.1</system.node.version>
        <system.npm.version>5.4.2</system.npm.version>
        <dependency.springboot.version>1.5.6.RELEASE</dependency.springboot.version>
        <plugin.springboot.version>1.5.9.RELEASE</plugin.springboot.version>
        <!-- plugin -->
        <plugin.frontend.version>0.0.27</plugin.frontend.version>
    </properties>
 
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>${dependency.springboot.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
 
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>${plugin.springboot.version}</version>
                <configuration>
                    <fork>true</fork>
                </configuration>
            </plugin>
            <!-- Frontend -->
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>${plugin.frontend.version}</version>
                <configuration>
                    <!-- angular 源码根目录 angular -->
                    <workingDirectory>src/main/angular</workingDirectory>
                    <nodeDownloadRoot>https://npm.taobao.org/mirrors/node/</nodeDownloadRoot>
                    <nodeVersion>${system.node.version}</nodeVersion>
                    <npmVersion>${system.npm.version}</npmVersion>
                    <installDirectory>target</installDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>install node and npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <phase>generate-resources</phase>
                    </execution>
                    <execution>
                        <id>npm install</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>install</arguments>
                            <installDirectory>target</installDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>angular cli build</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <arguments>run build</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
 
    </build>
 
</project>
复制代码
  • 修改.angular-cli.json文件编译输出配置
"outDir": "../resources/static",
复制代码
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值