frontend-maven-plugin icon indicating copy to clipboard operation
frontend-maven-plugin copied to clipboard

Package installing to a wrong workingDirectory.

Open cladwen opened this issue 1 year ago • 1 comments

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 [email protected]' 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 [email protected]
[INFO] npm info using [email protected]
[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 [email protected] No repository field.
[INFO] npm info package.json [email protected] No license field.
[INFO] npm info package.json [email protected] No README data
...
[INFO] npm info package.json [email protected] No license field.
[INFO] npm info package.json [email protected] string_decoder is also the name of a node core module.
[INFO] npm info package.json [email protected] No license field.
[INFO] npm info package.json [email protected] url is also the name of a node core module.
[INFO] npm info package.json [email protected] util is also the name of a node core module.
[INFO] npm info package.json [email protected] No license field.
[INFO] npm info package.json [email protected] No repository field.
[INFO] npm info package.json [email protected] No license field.
[INFO] npm info package.json [email protected] No license field.
[INFO] npm info package.json [email protected] No license field.
[INFO] npm info package.json [email protected] No repository field.
[INFO] npm info package.json [email protected] No README data
[INFO] npm info package.json [email protected] 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 [email protected] into /var/jenkins_home
[INFO] npm info installOne [email protected]
[INFO] npm info preuninstall [email protected]
[INFO] npm info uninstall [email protected]
[INFO] npm info postuninstall [email protected]
[INFO] npm info preinstall [email protected]
[INFO] npm info build /var/jenkins_home/node_modules/aifmd-client
[INFO] npm info linkStuff [email protected]
[INFO] npm info install [email protected]
[INFO] npm info postinstall [email protected]

[INFO] [email protected] ../../../../../../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 [email protected] into /var/jenkins_home

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

Thank you so much

cladwen avatar Oct 31 '24 16:10 cladwen

When using de npm goal try to make a npm install it does not take into account the workingDirectory property. the yarn goal works well.

arisjramos avatar Dec 19 '24 10:12 arisjramos