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.27k stars 873 forks source link

npx goal causes "Plugin execution not covered by lifecycle configuration" warning in VS Code #1150

Closed heathharrelson closed 6 months ago

heathharrelson commented 6 months ago

Do you want to request a feature or report a bug?

Report a bug

What is the current behavior?

VS Code warns that "Plugin execution not covered by lifecycle configuration" when there is an npx execution in pom.xml.

Screenshot 2024-06-05 at 11 34 30 AM

Full error:

Plugin execution not covered by lifecycle configuration: com.github.eirslett:frontend-maven-plugin:1.15.0:npx (execution: sass, phase: generate-resources)Java(0)

There are no errors or warning when I compile on the command line. This is similar to the behavior in #531, and I was able to fix the issue locally by adding npx to lifecycle-mapping-metadata.xml. I can submit a PR if that's desirable.

If the current behavior is a bug, please provide the steps to reproduce.

Add an <execution> that uses the npx goal to pom.xml. In my case, the <build> section of pom.xml looks like this:

    <build>
        <!-- Build without version number; only affects JAR file in /target. -->
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>1.15.0</version>
                <executions>
                    <execution>
                        <id>install-node-and-npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>npm-install</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>webpack</id>
                        <goals>
                            <goal>webpack</goal>
                        </goals>
                        <configuration>
                            <arguments>${webpack.args}</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>sass</id>
                        <goals>
                            <goal>npx</goal>
                        </goals>
                        <configuration>
                            <arguments>sass --load-path ${project.basedir}/node_modules ${project.basedir}/src/main/resources/frontend/scss/app.scss ${project.build.directory}/classes/static/assets/css/app.css</arguments>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <nodeVersion>${node.version}</nodeVersion>
                    <installDirectory>target</installDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>

The cowsay example works just as well.

    <build>
        <!-- Build without version number; only affects JAR file in /target. -->
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>1.15.0</version>
                <executions>
                    <execution>
                        <id>install-node-and-npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>npm-install</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>webpack</id>
                        <goals>
                            <goal>webpack</goal>
                        </goals>
                        <configuration>
                            <arguments>${webpack.args}</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npx cowsay</id>
                        <goals>
                            <goal>npx</goal>
                        </goals>
                        <configuration>
                            <arguments>-y cowsay@1.5.0 hello</arguments>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <nodeVersion>${node.version}</nodeVersion>
                    <installDirectory>target</installDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>

What is the expected behavior?

An npx execution in pom.xml does not trigger a warning in VS Code.

Please mention your frontend-maven-plugin and operating system version.

plugin version: 1.15.0 operating system: macOS Ventura 13.6.3 VS Code: 1.89.1

heathharrelson commented 2 months ago

@eirslett Any guess when the fix for this issue might get released?

eirslett commented 2 months ago

Looks like I finally managed to make OSSRH work, so with some luck, it should be out there in a few minutes or hours.