Java 在gitlab.com上运行maven build,使用eirslett:frontendmaven插件

Java 在gitlab.com上运行maven build,使用eirslett:frontendmaven插件,java,maven,docker,gitlab,gitlab-ci-runner,Java,Maven,Docker,Gitlab,Gitlab Ci Runner,我有一个带有前端项目模块的maven项目,我用eirslett:FrontEndMaven插件将其打包。它在本地运行正常,但在gitlab.com上构建失败 我使用以下命令启动构建。gitlab-ci.yml: image: maven:3.3.9-jdk-8-onbuild build: script: "mvn clean install -B -X" 这个pom.xml: <?xml version="1.0" encoding="UTF-8"?> <projec

我有一个带有前端项目模块的maven项目,我用eirslett:FrontEndMaven插件将其打包。它在本地运行正常,但在gitlab.com上构建失败

我使用以下命令启动构建。gitlab-ci.yml:

image: maven:3.3.9-jdk-8-onbuild

build:
  script: "mvn clean install -B -X"
这个pom.xml:

<?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>fr.nev.oms</groupId>
    <artifactId>oms-frontend</artifactId>
    <packaging>jar</packaging>

    <parent>
      <groupId>fr.nev.oms</groupId>
      <artifactId>myproject</artifactId>
      <version>1.0.0-SNAPSHOT</version>
    </parent>

    <build>
    <plugins>
      <plugin>
        <groupId>com.github.eirslett</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <version>1.3</version>
        <configuration>
            <!--<configuration>-->
                <nodeVersion>v4.4.7</nodeVersion>
                <npmVersion>3.10.5</npmVersion>
            <!--</configuration>-->
            <environmentVariables>
              <NODE_ENV>production</NODE_ENV>
              <API_URL></API_URL>
              <APP_VERSION></APP_VERSION>
            </environmentVariables>
        </configuration>
        <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>
            <configuration>
              <arguments>install</arguments>
            </configuration>
          </execution>

          <execution>
            <id>npm run build</id>
            <goals>
              <goal>npm</goal>
            </goals>
            <configuration>
              <arguments>run build</arguments>
            </configuration>
          </execution>

        </executions>
      </plugin>
    </plugins>
  </build>
</project>

4.0.0
fr.nev.oms
oms前端
罐子
fr.nev.oms
我的项目
1.0.0-SNAPSHOT
com.github.eirslett
前端maven插件
1.3
v4.4.7
3.10.5
生产
安装节点和npm
安装节点和npm
npm安装
npm
安装
npm运行构建
npm
运行构建
在gitlab.com上,我有以下跟踪:

[DEBUG] Configuring mojo com.github.eirslett:frontend-maven-plugin:1.3:install-node-and-npm from plugin realm ClassRealm[plugin>com.github.eirslett:frontend-maven-plugin:1.3, parent: sun.misc.Launcher$AppClassLoader@677327b6]
[DEBUG] Configuring mojo 'com.github.eirslett:frontend-maven-plugin:1.3:install-node-and-npm' with basic configurator -->
[DEBUG]   (f) environmentVariables = {API_URL=null, APP_VERSION=null, NODE_ENV=production}
[DEBUG]   (f) nodeDownloadRoot = https://nodejs.org/dist/
[DEBUG]   (f) nodeVersion = v4.4.7
[DEBUG]   (f) npmDownloadRoot = http://registry.npmjs.org/npm/-/
[DEBUG]   (f) npmVersion = 3.10.5
[DEBUG]   (f) project = MavenProject: fr.nev.oms:oms-frontend:1.0.0-SNAPSHOT @ /builds/nieven/on-my-shelves/oms-frontend/pom.xml
[DEBUG]   (f) repositorySystemSession = org.eclipse.aether.DefaultRepositorySystemSession@a10c1b5
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@644abb8f
[DEBUG]   (f) skip = false
[DEBUG]   (f) skipTests = false
[DEBUG]   (f) workingDirectory = /builds/nieven/on-my-shelves/oms-frontend
[DEBUG]   (f) execution = com.github.eirslett:frontend-maven-plugin:1.3:install-node-and-npm {execution: install node and npm}
[DEBUG] -- end configuration --
[INFO] Installing node version v4.4.7
[DEBUG] Creating install directory /builds/nieven/on-my-shelves/oms-frontend/node
[DEBUG] Creating temporary directory /builds/nieven/on-my-shelves/oms-frontend/node/tmp
[INFO] Downloading https://nodejs.org/dist/v4.4.7/node-v4.4.7-linux-x64.tar.gz to /root/.m2/repository/com/github/eirslett/node/4.4.7/node-4.4.7-linux-x64.tar.gz
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
[INFO] Unpacking /root/.m2/repository/com/github/eirslett/node/4.4.7/node-4.4.7-linux-x64.tar.gz into /builds/nieven/on-my-shelves/oms-frontend/node/tmp
[INFO] Copying node binary from /builds/nieven/on-my-shelves/oms-frontend/node/tmp/node-v4.4.7-linux-x64/bin/node to /builds/nieven/on-my-shelves/oms-frontend/node/node
[DEBUG] Deleting temporary directory /builds/nieven/on-my-shelves/oms-frontend/node/tmp
[INFO] Installed node locally.
[INFO] Installing npm version 3.10.5
[INFO] Downloading http://registry.npmjs.org/npm/-/npm-3.10.5.tgz to /root/.m2/repository/com/github/eirslett/npm/3.10.5/npm-3.10.5.tar.gz
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
[INFO] Unpacking /root/.m2/repository/com/github/eirslett/npm/3.10.5/npm-3.10.5.tar.gz into /builds/nieven/on-my-shelves/oms-frontend/node/node_modules
[INFO] Installed npm locally.
[INFO] 
[INFO] --- frontend-maven-plugin:1.3:npm (npm install) @ oms-frontend ---
[DEBUG] Configuring mojo com.github.eirslett:frontend-maven-plugin:1.3:npm from plugin realm ClassRealm[plugin>com.github.eirslett:frontend-maven-plugin:1.3, parent: sun.misc.Launcher$AppClassLoader@677327b6]
[DEBUG] Configuring mojo 'com.github.eirslett:frontend-maven-plugin:1.3:npm' with basic configurator -->
[DEBUG]   (f) arguments = install
[DEBUG]   (f) environmentVariables = {API_URL=null, APP_VERSION=null, NODE_ENV=production}
[DEBUG]   (f) npmInheritsProxyConfigFromMaven = true
[DEBUG]   (f) project = MavenProject: fr.nev.oms:oms-frontend:1.0.0-SNAPSHOT @ /builds/nieven/on-my-shelves/oms-frontend/pom.xml
[DEBUG]   (f) repositorySystemSession = org.eclipse.aether.DefaultRepositorySystemSession@a10c1b5
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@644abb8f
[DEBUG]   (f) skip = false
[DEBUG]   (f) skipTests = false
[DEBUG]   (f) workingDirectory = /builds/nieven/on-my-shelves/oms-frontend
[DEBUG]   (f) execution = com.github.eirslett:frontend-maven-plugin:1.3:npm {execution: npm install}
[DEBUG] -- end configuration --
[INFO] Running 'npm install' in /builds/nieven/on-my-shelves/oms-frontend
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] myproject .......................................... SUCCESS [  3.446 s]
[INFO] oms-frontend ....................................... FAILURE [  8.628 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.254 s
[INFO] Finished at: 2016-12-11T12:14:19+00:00
[INFO] Final Memory: 14M/197M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.3:npm (npm install) on project oms-frontend: Execution npm install of goal com.github.eirslett:frontend-maven-plugin:1.3:npm failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.3:npm (npm install) on project oms-frontend: Execution npm install of goal com.github.eirslett:frontend-maven-plugin:1.3:npm failed.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution npm install of goal com.github.eirslett:frontend-maven-plugin:1.3:npm failed.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 20 more
Caused by: java.lang.NullPointerException
    at java.lang.ProcessEnvironment.validateValue(ProcessEnvironment.java:120)
    at java.lang.ProcessEnvironment.access$400(ProcessEnvironment.java:61)
    at java.lang.ProcessEnvironment$Value.valueOf(ProcessEnvironment.java:203)
    at java.lang.ProcessEnvironment$StringEnvironment.put(ProcessEnvironment.java:243)
    at java.lang.ProcessEnvironment$StringEnvironment.put(ProcessEnvironment.java:221)
    at java.util.AbstractMap.putAll(AbstractMap.java:281)
    at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.createProcessBuilder(ProcessExecutor.java:103)
    at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.<init>(ProcessExecutor.java:37)
    at com.github.eirslett.maven.plugins.frontend.lib.NodeExecutor.<init>(NodeExecutor.java:20)
    at com.github.eirslett.maven.plugins.frontend.lib.NodeTaskExecutor.execute(NodeTaskExecutor.java:58)
    at com.github.eirslett.maven.plugins.frontend.mojo.NpmMojo.execute(NpmMojo.java:62)
    at com.github.eirslett.maven.plugins.frontend.mojo.AbstractFrontendMojo.execute(AbstractFrontendMojo.java:89)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    ... 21 more
[ERROR] 
[DEBUG]配置mojo com.github.eirslett:frontend maven插件:1.3:从插件领域ClassRealm安装节点和npm[plugin>com.github.eirslett:frontend maven插件:1.3,父级:sun.misc.Launcher$AppClassLoader@677327b6]
[调试]使用基本配置程序-->
[DEBUG](f)environmentVariables={API_URL=null,APP_VERSION=null,NODE_ENV=production}
[调试](f)nodeDownloadRoot=https://nodejs.org/dist/
[DEBUG](f)nodeVersion=v4.4.7
[调试](f)npmDownloadRoot=http://registry.npmjs.org/npm/-/
[调试](f)npmVersion=3.10.5
[DEBUG](f)project=MavenProject:fr.nev.oms:oms frontend:1.0.0-SNAPSHOT@/builds/nieven/on my shelfs/oms frontend/pom.xml
[DEBUG](f)repositorySystemSession=org.eclipse.ether。DefaultRepositorySystemSession@a10c1b5
[DEBUG](f)session=org.apache.maven.execution。MavenSession@644abb8f
[DEBUG](f)skip=false
[DEBUG](f)skipTests=false
[DEBUG](f)workingDirectory=/builds/nieven/在我的工具架上/oms前端
[DEBUG](f)execution=com.github.eirslett:frontendmaven插件:1.3:install node和npm{execution:install node和npm}
[调试]--结束配置--
[信息]安装节点版本v4.4.7
[调试]在我的工具架/oms前端/节点上创建安装目录/builds/nieven/
[调试]在我的工具架上创建临时目录/builds/nieven/oms frontend/node/tmp
[信息]下载https://nodejs.org/dist/v4.4.7/node-v4.4.7-linux-x64.tar.gz 到/root/.m2/repository/com/github/eirslett/node/4.4.7/node-4.4.7-linux-x64.tar.gz
[信息]未配置任何代理
[信息]未配置代理,直接下载
[信息]将/root/.m2/repository/com/github/eirslett/node/4.4.7/node-4.4.7-linux-x64.tar.gz解包到/builds/nieven/on my shelfs/oms frontend/node/tmp中
[信息]将节点二进制文件从/builds/nieven/我的托架上/oms前端/node/tmp/node-v4.4.7-linux-x64/bin/node复制到/builds/nieven/我的托架上/oms前端/node/node
[调试]删除临时目录/builds/nieven/在我的工具架上/oms前端/node/tmp
[信息]本地安装的节点。
[信息]安装npm版本3.10.5
[信息]下载http://registry.npmjs.org/npm/-/npm-3.10.5.tgz 到/root/.m2/repository/com/github/eirslett/npm/3.10.5/npm-3.10.5.tar.gz
[信息]未配置任何代理
[信息]未配置代理,直接下载
[信息]将/root/.m2/repository/com/github/eirslett/npm/3.10.5/npm-3.10.5.tar.gz解包到/builds/nieven/on my shelfs/oms frontend/node\u模块中
[信息]在本地安装了npm。
[信息]
[信息]---前端maven插件:1.3:npm(npm安装)@oms前端---
[调试]配置mojo com.github.eirslett:frontend maven插件:1.3:npm来自插件领域ClassRealm[插件>com.github.eirslett:frontend maven插件:1.3,父级:sun.misc.Launcher$AppClassLoader@677327b6]
[调试]使用基本配置程序-->
[调试](f)参数=安装
[DEBUG](f)environmentVariables={API_URL=null,APP_VERSION=null,NODE_ENV=production}
[DEBUG](f)npmInheritsProxyConfigFromMaven=true
[DEBUG](f)project=MavenProject:fr.nev.oms:oms frontend:1.0.0-SNAPSHOT@/builds/nieven/on my shelfs/oms frontend/pom.xml
[DEBUG](f)repositorySystemSession=org.eclipse.ether。DefaultRepositorySystemSession@a10c1b5
[DEBUG](f)session=org.apache.maven.execution。MavenSession@644abb8f
[DEBUG](f)skip=false
[DEBUG](f)skipTests=false
[DEBUG](f)workingDirectory=/builds/nieven/在我的工具架上/oms前端
[DEBUG](f)execution=com.github.eirslett:frontendmaven插件:1.3:npm{execution:npm install}
[调试]--结束配置--
[信息]在我的工具架/oms前端的/builds/nieven/中运行“npm安装”
[信息]------------------------------------------------------------------------
[信息]反应堆概要:
[信息]
[信息]我的项目。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。成功[3.446秒]
[信息]oms前端。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。故障[8.628秒]
[信息]------------------------------------------------------------------------
[信息]生成失败
[信息]------------------------------------------------------------------------
[信息]总时间:12.254秒
[信息]完成时间:2016-12-11T12:14:19+00:00
[信息]最终内存:14M/197M
[信息]------------------------------------------------------------------------
[错误]无法在项目oms上执行目标com.github.eirslett:frontend maven插件:1.3:npm(npm安装):执行目标com.github.eirslett:frontend maven插件的npm安装:1.3:npm失败。NullPointerException->[帮助1]
org.apache.maven.lifecycle.LifecycleExecutionException:未能在项目oms前端:执行上执行目标com.github.eirslett:frontend maven插件:1.3:npm(npm安装)
<plugin>
  <groupId>com.github.eirslett</groupId>
  <artifactId>frontend-maven-plugin</artifactId>
  <version>1.4</version>