前后端分离项目,mvn打包自动打包前端文件至指定目录,依赖配置maven插件

插件配置

插件1

<plugin>
    <groupId>com.github.eirslettgroupId>
    <artifactId>frontend-maven-pluginartifactId>
    <version>1.9.1version>
    <configuration>
        <nodeVersion>v10.16.0nodeVersion>
        <npmVersion>6.9.0npmVersion>
        <nodeDownloadRoot>http://npm.taobao.org/mirrors/node/nodeDownloadRoot>
        <npmRegistryURL>https://registry.npm.taobao.orgnpmRegistryURL>
        <workingDirectory>../tjWebworkingDirectory>
    configuration>
    <executions>
        <execution>
            <id>install node and npmid>
            <phase>initializephase>
            <goals>
                <goal>install-node-and-npmgoal>
            goals>
        execution>
        <execution>
            <id>npm installid>
            <phase>generate-sourcesphase>
            <goals>
                <goal>npmgoal>
            goals>
            <configuration>
                <arguments>installarguments>
            configuration>
        execution>
        <execution>
            <id>npm run buildid>
            <phase>generate-resourcesphase>
            <goals>
                <goal>npmgoal>
            goals>
            <configuration>
                <arguments>run buildarguments>
            configuration>
        execution>
    executions>
plugin>

插件2

<plugin>
        <artifactId>maven-resources-pluginartifactId>
        <version>2.5version>
        <executions>
            <execution>
                <id>copy-frontendid>
                <phase>process-resourcesphase>
                <goals>
                    <goal>copy-resourcesgoal>
                goals>
                <configuration>
                    <outputDirectory>${basedir}/target/classes/staticoutputDirectory>
                    <resources>
                        <resource>
                            <directory>${basedir}/../tjWeb/distdirectory>
                            <includes>
                                <include>**/*.jsinclude>
                                <include>**/*.cssinclude>
                                <include>**/*.htmlinclude>
                                <include>**/*.pnginclude>
                                <include>**/*.woffinclude>
                                <include>**/*.tffinclude>
                            includes>
                        resource>
                    resources>
            configuration>
        execution>
    executions>
plugin>

你可能感兴趣的:(npm,Vue.js,JavaEE开发,maven配置前端打包,npm,vue,maven,nodejs)