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.26k stars 872 forks source link

Package installing to a wrong workingDirectory. #1166

Open cladwen opened 3 weeks ago

cladwen commented 3 weeks ago

I have encountered the following issue installing packages with the frontend-maven-plugin. WorkingDirectory configuration is lost in the installation phase of the package when maven is run from a Jenkins job.

The plugin configuration is as follows:

        <plugin>
            <groupId>com.github.eirslett</groupId>
            <artifactId>frontend-maven-plugin</artifactId>
            <version>1.15.1</version>

            <configuration>
                <installDirectory>${node.install.directory}</installDirectory>
                <workingDirectory>${webapp.source.directory}</workingDirectory>
            </configuration>

            <executions>
                <execution>
                    <id>install node and npm</id>
                    <goals>
                        <goal>install-node-and-npm</goal>
                    </goals>
                    <configuration>
                        <nodeVersion>v4.2.2</nodeVersion>
                        <npmVersion>2.14.7</npmVersion>
                    </configuration>
                </execution>

                <execution>
                    <id>npm install</id>
                    <goals>
                        <goal>npm</goal>
                    </goals>
                    <configuration>
                        <arguments>install -d aifmd-client@${aifmd-client.version}</arguments>
                    </configuration>
                </execution>
            </executions>
        </plugin>

In the log we can see how the workingDirectory is read correctly but finally the installation is performed in another directory:

[INFO] --- frontend-maven-plugin:1.15.1:npm (npm install) @ aifmd-webapp ---
[INFO] Running 'npm install -d aifmd-client@1.10.0-SNAPSHOT' in /var/jenkins_home/workspace/AIFMD-SNAPSHOT/aifmd-webapp/src/main/webapp
[INFO] npm info it worked if it ends with ok
[INFO] npm info using npm@2.14.7
[INFO] npm info using node@v4.2.2
[INFO] npm verb config Skipping project config: /var/jenkins_home/.npmrc. (matches userconfig)
[INFO] npm WARN package.json @ No description
[INFO] npm WARN package.json @ No repository field.
[INFO] npm WARN package.json @ No README data
[INFO] npm WARN package.json @ No license field.
[INFO] npm info package.json aifmd-client@1.9.1 No repository field.
[INFO] npm info package.json aifmd-client@1.9.1 No license field.
[INFO] npm info package.json copy-descriptor@0.1.1 No README data
...
[INFO] npm info package.json ripemd160@0.2.0 No license field.
[INFO] npm info package.json string_decoder@1.1.1 string_decoder is also the name of a node core module.
[INFO] npm info package.json timers-browserify@1.4.2 No license field.
[INFO] npm info package.json url@0.10.3 url is also the name of a node core module.
[INFO] npm info package.json util@0.10.4 util is also the name of a node core module.
[INFO] npm info package.json webpack-core@0.6.9 No license field.
[INFO] npm info package.json proteox-treasure-desk@3.24.0 No repository field.
[INFO] npm info package.json proteox-treasure-desk@3.24.0 No license field.
[INFO] npm info package.json window-size@0.1.0 No license field.
[INFO] npm info package.json webpack-dev-middleware@1.2.0 No license field.
[INFO] npm info package.json arcano-manager@2.1.0-39 No repository field.
[INFO] npm info package.json arcano-manager@2.1.0-39 No README data
[INFO] npm info package.json arcano-manager@2.1.0-39 No license field.
[INFO] npm info attempt registry request try #1 at 4:14:32 PM
[INFO] npm http request GET http://xxxxx.into/repository/aifmd-js/aifmd-client
[INFO] npm http 200 http://xxxxx.into/repository/aifmd-js/aifmd-client
[INFO] npm info retry fetch attempt 1 at 4:14:32 PM
[INFO] npm info attempt registry request try #1 at 4:14:32 PM
[INFO] npm http fetch GET http://xxxxx.into/repository/aifmd-js/aifmd-client/-/aifmd-client-1.10.0-SNAPSHOT.tgz
[INFO] npm http fetch 200 http://xxxxx.into/repository/aifmd-js/aifmd-client/-/aifmd-client-1.10.0-SNAPSHOT.tgz
[INFO] npm info install aifmd-client@1.10.0-SNAPSHOT into /var/jenkins_home
[INFO] npm info installOne aifmd-client@1.10.0-SNAPSHOT
[INFO] npm info preuninstall aifmd-client@1.9.1
[INFO] npm info uninstall aifmd-client@1.9.1
[INFO] npm info postuninstall aifmd-client@1.9.1
[INFO] npm info preinstall aifmd-client@1.10.0-SNAPSHOT
[INFO] npm info build /var/jenkins_home/node_modules/aifmd-client
[INFO] npm info linkStuff aifmd-client@1.10.0-SNAPSHOT
[INFO] npm info install aifmd-client@1.10.0-SNAPSHOT
[INFO] npm info postinstall aifmd-client@1.10.0-SNAPSHOT

[INFO] aifmd-client@1.10.0-SNAPSHOT ../../../../../../node_modules/aifmd-client
[INFO] npm info ok 

In the second line the correct working directory is shown but the package ends up being installed in another directory:

[INFO] npm info install aifmd-client@1.10.0-SNAPSHOT into /var/jenkins_home

Is any special configuration required to run the plugin from a Jenkins job?

Thank you so much