question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem using the plugin inside a Continuous Integration pipeline (Bitbucket pipeline)

See original GitHub issue

Hello,

we have a problem using the plugin (v1.9.1 or any other) in Bitbucket pipelines.

We have this pipeline:

pipelines:
    default:
    - step:
          name: Package
          image: maven:3.5-jdk-8-alpine
          caches:
          - maven
          script:
          - mvn install -X
          - mvn clean package -P environment=production
          artifacts:
          - target/*.war

The error that we have is:

+ mvn install -X
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T18:33:14Z)
Maven home: /usr/share/maven
Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-1.8-openjdk/jre 
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.19.78-coreos", arch: "amd64", family: "unix"
...
[DEBUG] Configuring mojo com.github.eirslett:frontend-maven-plugin:1.9.1:install-node-and-npm from plugin realm ClassRealm[plugin>com.github.eirslett:frontend-maven-plugin:1.9.1, parent: sun.misc.Launcher$AppClassLoader@70dea4e]
[DEBUG] Configuring mojo 'com.github.eirslett:frontend-maven-plugin:1.9.1:install-node-and-npm' with basic configurator -->
[DEBUG]   (f) installDirectory = /opt/atlassian/pipelines/agent/build/alert-web/target
[DEBUG]   (f) nodeDownloadRoot = https://nodejs.org/dist/
[DEBUG]   (f) nodeVersion = v10.9.0
[DEBUG]   (f) npmDownloadRoot = https://registry.npmjs.org/npm/-/
[DEBUG]   (f) npmVersion = provided
[DEBUG]   (f) project = MavenProject: es.company.alert:alert-web:1.0.0 @ /opt/atlassian/pipelines/agent/build/alert-web/pom.xml
[DEBUG]   (f) repositorySystemSession = org.eclipse.aether.DefaultRepositorySystemSession@63124c8b
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@d1d8e1a
[DEBUG]   (f) skipTests = false
[DEBUG]   (f) testFailureIgnore = false
[DEBUG]   (f) workingDirectory = /opt/atlassian/pipelines/agent/build/alert-web/src/main/resources/static/resources
[DEBUG]   (f) execution = com.github.eirslett:frontend-maven-plugin:1.9.1:install-node-and-npm {execution: install node and npm}
[DEBUG] -- end configuration --
[INFO] Installing node version v10.9.0
[DEBUG] Creating install directory /opt/atlassian/pipelines/agent/build/alert-web/target/node
[DEBUG] Creating temporary directory /opt/atlassian/pipelines/agent/build/alert-web/target/node/tmp
[INFO] Downloading https://nodejs.org/dist/v10.9.0/node-v10.9.0-linux-x64.tar.gz to /root/.m2/repository/com/github/eirslett/node/10.9.0/node-10.9.0-linux-x64.tar.gz
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
[INFO] Unpacking /root/.m2/repository/com/github/eirslett/node/10.9.0/node-10.9.0-linux-x64.tar.gz into /opt/atlassian/pipelines/agent/build/alert-web/target/node/tmp
[INFO] Copying node binary from /opt/atlassian/pipelines/agent/build/alert-web/target/node/tmp/node-v10.9.0-linux-x64/bin/node to /opt/atlassian/pipelines/agent/build/alert-web/target/node/node
[INFO] Extracting NPM
[DEBUG] Deleting temporary directory /opt/atlassian/pipelines/agent/build/alert-web/target/node/tmp
[INFO] Installed node locally.
[INFO] 
[INFO] --- frontend-maven-plugin:1.9.1:npm (npm install) @ alert-web ---
[DEBUG] Configuring mojo com.github.eirslett:frontend-maven-plugin:1.9.1:npm from plugin realm ClassRealm[plugin>com.github.eirslett:frontend-maven-plugin:1.9.1, parent: sun.misc.Launcher$AppClassLoader@70dea4e]
[DEBUG] Configuring mojo 'com.github.eirslett:frontend-maven-plugin:1.9.1:npm' with basic configurator -->
[DEBUG]   (f) arguments = install --no-optional
[DEBUG]   (f) installDirectory = /opt/atlassian/pipelines/agent/build/alert-web/target
[DEBUG]   (f) npmInheritsProxyConfigFromMaven = true
[DEBUG]   (f) project = MavenProject: es.company.alert:alert-web:1.0.0 @ /opt/atlassian/pipelines/agent/build/alert-web/pom.xml
[DEBUG]   (f) repositorySystemSession = org.eclipse.aether.DefaultRepositorySystemSession@63124c8b
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@d1d8e1a
[DEBUG]   (f) skipTests = false
[DEBUG]   (f) testFailureIgnore = false
[DEBUG]   (f) workingDirectory = /opt/atlassian/pipelines/agent/build/alert-web/src/main/resources/static/resources
[DEBUG]   (f) execution = com.github.eirslett:frontend-maven-plugin:1.9.1:npm {execution: npm install}
[DEBUG] -- end configuration --
[INFO] Running 'npm install --no-optional' in /opt/atlassian/pipelines/agent/build/alert-web/src/main/resources/static/resources
[DEBUG] Executing command line [/opt/atlassian/pipelines/agent/build/alert-web/target/node/node, /opt/atlassian/pipelines/agent/build/alert-web/target/node/node_modules/npm/bin/npm-cli.js, install, --no-optional]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] alert 1.0.0 ........................................ SUCCESS [  0.938 s]
[INFO] alert-util ......................................... SUCCESS [ 39.543 s]
[INFO] alert-business ...................................... SUCCESS [ 27.176 s]
[INFO] alert-web 1.0.0 .................................... FAILURE [  5.100 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:14 min
[INFO] Finished at: 2020-01-13T15:27:59Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.9.1:npm (npm install) on project alert-web: Failed to run task: 'npm install --no-optional' failed. 
java.io.IOException: Cannot run program "/opt/atlassian/pipelines/agent/build/alert-web/target/node/node" (in directory "/opt/atlassian/pipelines/agent/build/alert-web/src/main/resources/static/resources"): error=2, No such file or directory -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.9.1:npm (npm install) on project alert-web: Failed to run task
...
Caused by: org.apache.maven.plugin.MojoFailureException: Failed to run task
...
Caused by: com.github.eirslett.maven.plugins.frontend.lib.TaskRunnerException: 'npm install --no-optional' failed.
...
Caused by: com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutionException: java.io.IOException: Cannot run program "/opt/atlassian/pipelines/agent/build/alert-web/target/node/node" (in directory "/opt/atlassian/pipelines/agent/build/alert-web/src/main/resources/static/resources"): error=2, No such file or directory
...
Caused by: java.io.IOException: Cannot run program "/opt/atlassian/pipelines/agent/build/alert-web/target/node/node" (in directory "/opt/atlassian/pipelines/agent/build/alert-web/src/main/resources/static/resources"): error=2, No such file or directory
...
Caused by: java.io.IOException: error=2, No such file or directory
...
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :alert-web
Skipping cache upload for failed step`

The structure of our project is:

project |______alert-business |_______pom.xml |______alert-util |_______pom.xml |______alert-web |_______pom.xml |______pom.xml

We have a react aplication with package.json inside one folder of alert-web subproject.

The aplication is compiling in local but not in the pipeline.

The pom.xml inside the alert-web subproject is:

<?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>
    <artifactId>alert-web</artifactId>
    <packaging>war</packaging>
    <name>alert-web</name>
    <description>....</description>
    <parent>
        <groupId>es.company.alert</groupId>
        <artifactId>alert</artifactId>
        <version>1.0.0</version>
    </parent>
<properties>
    <aspectj.version>1.8.10</aspectj.version>
    <node.version>v10.9.0</node.version>
    <frontend-maven-plugin>1.9.1</frontend-maven-plugin>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
    </dependency>
    <dependency>
        <groupId>es.company.alert</groupId>
        <artifactId>alert-util</artifactId>
        <version>1.0.0</version>
    </dependency>
    <dependency>
        <groupId>es.company.alert</groupId>
        <artifactId>alert-business</artifactId>
        <version>1.0.0</version>
    </dependency>
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>2.9.2</version>
    </dependency>
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>2.9.2</version>
    </dependency>
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-all</artifactId>
        <version>1.3</version>
        <scope>test</scope>
    </dependency>
</dependencies>
<profiles>
    <profile>
        <id>local</id>
        <properties>
            <activatedProperties>local</activatedProperties>
        </properties>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>com.github.eirslett</groupId>
                    <artifactId>frontend-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>npm run build</id>
                            <goals>
                                <goal>npm</goal>
                            </goals>
                            <phase>generate-resources</phase>
                            <configuration>
                                <arguments>run build:local --no-optional</arguments>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <id>develop</id>
        <properties>
            <activatedProperties>develop</activatedProperties>
        </properties>
        <build>
            <plugins>
                <plugin>
                    <groupId>com.github.eirslett</groupId>
                    <artifactId>frontend-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>npm run build</id>
                            <goals>
                                <goal>npm</goal>
                            </goals>
                            <phase>generate-resources</phase>
                            <configuration>
                                <arguments>run build:dev --no-optional</arguments>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <id>production</id>
        <properties>
            <activatedProperties>production</activatedProperties>
        </properties>
        <build>
            <plugins>
                <plugin>
                    <groupId>com.github.eirslett</groupId>
                    <artifactId>frontend-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>npm run build</id>
                            <goals>
                                <goal>npm</goal>
                            </goals>
                            <phase>generate-resources</phase>
                            <configuration>
                                <arguments>run build:production --no-optional</arguments>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>

</profiles>
<build>
    <!--
    <sourceDirectory>${project.build.directory}/generated-sources/delombok</sourceDirectory>
    -->
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
            <excludes>
                <exclude>**/node_modules/**</exclude>
                <exclude>**/react/**</exclude>
                <exclude>**/fonts/**</exclude>
            </excludes>
        </resource>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>false</filtering>
            <includes>
                <include>**/fonts/**</include>
            </includes>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <configuration>
                <nonFilteredFileExtensions>
                    <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
                    <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
                    <nonFilteredFileExtension>woff</nonFilteredFileExtension>
                    <nonFilteredFileExtension>svg</nonFilteredFileExtension>
                </nonFilteredFileExtensions>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
                <warName>alert</warName>
                <warSourceExcludes>node_modules/,react/</warSourceExcludes>
                <packagingExcludes>**/src/main/static/resources/node_modules/,**/src/main/static/resources/node/
                </packagingExcludes>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>
        <plugin>
            <groupId>com.github.eirslett</groupId>
            <artifactId>frontend-maven-plugin</artifactId>
            <version>1.9.1</version>
            <configuration>
                <nodeVersion>${node.version}</nodeVersion>
                <installDirectory>target</installDirectory>
                <workingDirectory>src/main/resources/static/resources</workingDirectory>
                <nodeDownloadRoot>https://nodejs.org/dist/</nodeDownloadRoot>
            </configuration>
            <executions>
                <execution>
                    <id>install node and npm</id>
                    <goals>
                        <goal>install-node-and-npm</goal>
                    </goals>
                    <phase>generate-resources</phase>
                </execution>
                <execution>
                    <id>npm install</id>
                    <goals>
                        <goal>npm</goal>
                    </goals>
                    <phase>generate-resources</phase>
                    <configuration>
                        <arguments>install --no-optional</arguments>
                        <installDirectory>target</installDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.7.9</version>
            <executions>
                <execution>
                    <id>default-prepare-agent</id>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
                <execution>
                    <id>default-report</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <trimStackTrace>false</trimStackTrace>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <configuration>
                <filesets>
                    <fileset>
                        <directory>src/main/resources/static/resources/dist</directory>
                        <followSymlinks>false</followSymlinks>
                    </fileset>
                </filesets>
            </configuration>
        </plugin>
    </plugins>
    <finalName>alert</finalName>
</build>

</project>`

We try to solve the error installing npm in the pipeline but we can’t not compile the project. We also try to use others docker images for the pipeline but we have the same error.

Can you help us?

Thanks.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ghostcommented, Mar 21, 2020

Normal npm/node releases won’t work on Alpine or any musl-libc based distribution. I had to abandon Alpine at work because this plugin is in many of our projects.

0reactions
breuncommented, Apr 20, 2021

frontend-maven-plugin downloads a musl-based NodeJS since https://github.com/eirslett/frontend-maven-plugin/pull/853, so there should no longer be a need to install glibc (which adds quite a bit of disk usage to that otherwise tiny Alpine image, and I guess keeping it small is the point of using Alpine).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bitbucket Pipelines - Continuous Delivery
Bitbucket Pipelines brings continuous integration and delivery to Bitbucket Cloud, empowering teams to build, test, and deploy their code within Bitbucket.
Read more >
Bitbucket Pipelines integrations - Atlassian Support
Integrate with Bitbucket Pipelines to deploy, test, monitor, analyze code, or store artifacts.
Read more >
Continuous Integration with Bitbucket - Support Center
Bitbucket is a service from Atlassian that allows you to continuously integrate and deploy your code from your local machine to a Git ......
Read more >
Continuous Integration: Bitbucket Pipelines and Static Code ...
This problem is compounded further when dependency (module/plugin) updates break existing code. Skipping dependency updates is, of course, not ...
Read more >
Bitbucket Pipelines Continuous Integration CI/CD - Provar
To set up Bitbucket Pipelines, you need to first create and configure the bitbucket-pipelines.yml file in the root directory of your repository. You...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found