eirslett / frontend-maven-plugin

"Maven-node-grunt-gulp-npm-node-plugin to end all maven-node-grunt-gulp-npm-plugins." A Maven plugin that downloads/installs Node and NPM locally, runs NPM install, Grunt, Gulp and/or Karma.
Apache License 2.0
4.23k stars 868 forks source link

frontent plugin doesnt run. #896

Closed hellerEkc closed 4 years ago

hellerEkc commented 4 years ago

Hi, I have this maven configuration :


<?xml version="1.0" encoding="UTF-8"?>

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.heller.contact.app</groupId>
    <artifactId>ContactsApp</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>ContactsApp Maven Webapp</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>5.2.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>5.2.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>5.2.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>5.2.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>5.2.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>5.2.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>5.2.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>5.2.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>5.2.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.4.14.Final</version>
            <exclusions>
                <exclusion>
                    <groupId>org.jboss.logging</groupId>
                    <artifactId>jboss-logging</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hibernate.common</groupId>
                    <artifactId>
                        hibernate-commons-annotations
                    </artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.10.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-dbcp</artifactId>
            <version>9.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.0-api</artifactId>
            <version>1.0.1.Final</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.19</version>
        </dependency>
        <dependency>
            <groupId>net.sf.dozer</groupId>
            <artifactId>dozer</artifactId>
            <version>5.4.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.26</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging</artifactId>
            <version>3.4.1.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate.common</groupId>
            <artifactId>hibernate-commons-annotations</artifactId>
            <version>5.0.4.Final</version>
        </dependency>

    </dependencies>

    <build>
        <finalName>ContactsApp</finalName>
        <pluginManagement><!-- lock down plugins versions to avoid using Maven 
                defaults (may be moved to parent pom) -->
            <plugins>
                 <plugin>
                    <groupId>com.github.eirslett</groupId>
                    <artifactId>frontend-maven-plugin</artifactId>
                    <version>1.6</version>
                    <configuration>
                        <workingDirectory>src/main/frontend</workingDirectory>
                        <installDirectory>target</installDirectory>
                    </configuration>
                    <executions>
                        <execution>
                            <id>npm install</id>
                            <goals>
                                <goal>npm</goal>
                            </goals>
                            <configuration>
                                <arguments>install</arguments>
                            </configuration>
                        </execution>
                        <execution>
                            <id>npm build</id>
                            <goals>
                                <goal>npm</goal>
                            </goals>
                            <configuration>
                                <arguments>run buildProduction</arguments>
                            </configuration>
                            <phase>generate-resources</phase>
                        </execution>
                    </executions>
                </plugin> 
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.0.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>3.2.2</version>
                    <!-- <configuration>
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                        Add frontend folder to war package
                        <webResources>
                            <resource>
                                <directory>src/main/frontend/dist/frontend</directory>
                            </resource>
                        </webResources>
                    </configuration> -->
                </plugin>
                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.5.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.tomcat.maven</groupId>
                    <artifactId>tomcat7-maven-plugin</artifactId>
                    <version>2.2</version>
                    <configuration>
                        <url>http://localhost:8080/manager/text</url>
                        <path>/ContactsApp</path>
                        <!-- Set update to true to avoid exist war package can not be override 
                            error -->
                        <update>true</update>
                        <!-- Because deploy this maven project using plugin in pom so use the 
                            manager-script role user. -->
                        <username>admin</username>
                        <password>admin</password>
                    </configuration>

                </plugin>
            </plugins>
        </pluginManagement>

    </build>
</project>

When I run mvn clean install, it produces this log: D:\data\07_AngularContactApp\ContactsApp>mvn clean install [INFO] Scanning for projects... [INFO] [INFO] -----------------< org.heller.contact.app:ContactsApp >----------------- [INFO] Building ContactsApp Maven Webapp 0.0.1-SNAPSHOT [INFO] --------------------------------[ war ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ ContactsApp --- [INFO] Deleting D:\data\07_AngularContactApp\ContactsApp\target [INFO] [INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ ContactsApp --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 2 resources [INFO] [INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ ContactsApp --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 7 source files to D:\data\07_AngularContactApp\ContactsApp\target\classes [INFO] [INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ ContactsApp --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory D:\data\07_AngularContactApp\ContactsApp\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ ContactsApp --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ ContactsApp --- [INFO] No tests to run. [INFO] [INFO] --- maven-war-plugin:3.2.2:war (default-war) @ ContactsApp --- [INFO] Packaging webapp [INFO] Assembling webapp [ContactsApp] in [D:\data\07_AngularContactApp\ContactsApp\target\ContactsApp] [INFO] Processing war project [INFO] Copying webapp resources [D:\data\07_AngularContactApp\ContactsApp\src\main\webapp] [INFO] Webapp assembled in [272 msecs] [INFO] Building war: D:\data\07_AngularContactApp\ContactsApp\target\ContactsApp.war [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ ContactsApp --- [INFO] Installing D:\data\07_AngularContactApp\ContactsApp\target\ContactsApp.war to C:\Users\petr.m2\repository\org\heller\contact\app\ContactsApp\0.0.1-SNAPSHOT\ContactsApp-0.0.1-SNAPSHOT.war [INFO] Installing D:\data\07_AngularContactApp\ContactsApp\pom.xml to C:\Users\petr.m2\repository\org\heller\contact\app\ContactsApp\0.0.1-SNAPSHOT\ContactsApp-0.0.1-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.270 s [INFO] Finished at: 2020-04-27T16:48:49+02:00 [INFO] ---------------------------------------------------------------------

It seams that frontend plugin didnt run. Any objections how to solve this issue?

eirslett commented 4 years ago

You put it in <pluginManagement>, but it should be in <plugins> directly under <build>. In Maven, pluginManagement is only for configuration, it doesn't actually run the plugins.