简体   繁体   中英

Maven ignores maven-frontend-plugin, no error

<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>

With this build config, I don't know why maven completely looks ignore to execute frontend-maven-plugin .

I can run bower install through command prompt successfully and it downloads the dependencies.

But I am not able to do the same using maven build.

I tried with different versions of front-maven-plugin, but couldn't run this plugin. And also tried other possible solutions from web.

I don't get any error or info about this plugin when I doing maven build.

Can anyone help me?

Your plugins are inside the <pluginManagement> tag, try removing these tags.

From Maven Documentation :

pluginManagement: is an element that is seen along side plugins. Plugin Management contains plugin elements in much the same way, except that rather than configuring plugin information for this particular project build, it is intended to configure project builds that inherit from this one. However, this only configures plugins that are actually referenced within the plugins element in the children or in the current POM. The children have every right to override pluginManagement definitions.

So this means I think your plugin is merely being passed on to your (non-existent) children and not actually being used.

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