【问题标题】:Maven ignores maven-frontend-plugin, no errorMaven 忽略 maven-frontend-plugin,没有错误
【发布时间】:2017-03-14 19:46:45
【问题描述】:
<build>
    <pluginManagement>
        <plugins>                       

            <!-- Plugin to execute command  "npm install" and "npm run build" inside /angular directory -->
            <plugin>
              <groupId>com.github.eirslett</groupId>
              <artifactId>frontend-maven-plugin</artifactId>
              <version>0.0.22</version>
              <configuration>
              <skip>false</skip>
                <workingDirectory>${basedir}</workingDirectory>
                <installDirectory>${basedir}/temp</installDirectory>
              </configuration>
              <executions>
                <!-- It will install nodejs and npm -->
                <execution>
                  <id>install node and npm</id>
                  <goals>
                    <goal>install-node-and-npm</goal>
                  </goals>
                  <configuration>
                    <nodeVersion>v6.3.1</nodeVersion>
                    <npmVersion>3.9.5</npmVersion>
                  </configuration>
                </execution>

                <!-- It will execute command "npm install" inside "/angular" directory -->
                <execution>
                  <id>npm install</id>
                  <goals>
                    <goal>npm</goal>
                  </goals>
                  <phase>generate-sources</phase>
                  <configuration>
                    <arguments>install</arguments>
                  </configuration>
                </execution>        

                <execution>
                    <id>bower install</id>
                    <goals>
                        <goal>bower</goal>
                    </goals>
                    <phase>generate-sources</phase>
                    <configuration>
                        <arguments>
                            <argument>install</argument>
                        </arguments>
                        <workingDirectory>${basedir}</workingDirectory>
                    </configuration>
                </execution>

              </executions>
            </plugin>


            <!-- Plugin to copy the content of /angular/dist/ directory to output directory (ie/ /target/transactionManager-1.0/) -->
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-resources-plugin</artifactId>
              <version>2.4.2</version>
              <executions>
                <execution>
                  <id>default-copy-resources</id>
                  <phase>process-resources</phase>
                  <goals>
                    <goal>copy-resources</goal>
                  </goals>
                  <configuration>
                    <overwrite>true</overwrite>
                    <outputDirectory>${basedir}/target/classes/static/app/bower_components</outputDirectory>
                    <resources>
                      <resource>
                        <directory>${basedir}/src/main/resources/static/app/bower_components</directory>
                      </resource>
                    </resources>
                  </configuration>
                </execution>
              </executions>
            </plugin>

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>

        </plugins>
        </pluginManagement>
    </build>

有了这个构建配置,我不知道为什么 maven 看起来完全忽略执行frontend-maven-plugin

我可以通过命令提示符成功运行bower install,它会下载依赖项。

但我无法使用 Maven 构建来做同样的事情。

我尝试了不同版本的 front-maven-plugin,但无法运行此插件。并且还尝试了其他可能的网络解决方案。

当我进行 maven 构建时,我没有收到有关此插件的任何错误或信息。

谁能帮帮我?

【问题讨论】:

    标签: java maven spring-boot npm bower


    【解决方案1】:

    您的插件位于&lt;pluginManagement&gt; 标签内,请尝试删除这些标签。

    来自Maven Documentation

    pluginManagement: 是一个与侧面插件一起出现的元素。 插件管理以几乎相同的方式包含插件元素, 除了为此配置插件信息 特定的项目构建,它旨在配置项目构建 从这个继承。但是,这只配置插件 实际上是在子元素的插件元素中引用的,或者 在当前的 POM 中。孩子们有权推翻 pluginManagement 定义。

    所以这意味着我认为你的插件只是被传递给你的(不存在的)孩子而不是真正被使用。

    【讨论】:

      猜你喜欢
      • 2016-09-27
      • 2014-02-23
      • 2019-04-30
      • 1970-01-01
      • 2016-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多