maven在本地上工作,但在使用javascript资源时在jenkins上失败
我必须编译google polymer资源,并将它们放在一个特定的文件夹中,在本地(windows 10与Ubuntu Linux shell集成)可以完美地工作,但在我的jenkins上(在Ubuntu 17.04服务器上的Docker容器中),它失败了 我是詹金斯的新手,这是我的第一次测试 pom配置已打开 以下是管道的配置:maven在本地上工作,但在使用javascript资源时在jenkins上失败,javascript,java,maven,jenkins,polymer,Javascript,Java,Maven,Jenkins,Polymer,我必须编译google polymer资源,并将它们放在一个特定的文件夹中,在本地(windows 10与Ubuntu Linux shell集成)可以完美地工作,但在我的jenkins上(在Ubuntu 17.04服务器上的Docker容器中),它失败了 我是詹金斯的新手,这是我的第一次测试 pom配置已打开 以下是管道的配置: node { def mvnHome def nodeHome stage('Preparation') { // for display purp
node {
def mvnHome
def nodeHome
stage('Preparation') { // for display purposes
// Get some code from a GitHub repository
git 'https://github.com/ITGuy9401/RPGMakerVXtoMVConverterWEB.git'
// Get the Maven tool.
// ** NOTE: This 'M3' Maven tool must be configured
// ** in the global configuration.
mvnHome = tool 'maven35'
nodeHome = tool 'nodejs840'
env.PATH = "${nodeHome}/bin:${mvnHome}/bin:${env.PATH}"
}
stage('Build') {
// Run the maven build
if (isUnix()) {
sh "'${mvnHome}/bin/mvn' -Dmaven.test.failure.ignore clean package"
} else {
bat(/"${mvnHome}\bin\mvn" -Dmaven.test.failure.ignore clean package/)
}
}
stage('Results') {
junit '**/target/surefire-reports/TEST-*.xml'
archive 'target/*.jar'
}
}
还有控制台输出
[INFO] ------------------------------------------------------------------------
[INFO] Building app 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ app ---
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (clean-web-res) @ app ---
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (prepare-resource-folder) @ app ---
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (npm-install) @ app ---
npm WARN polymer-starter-kit@ No repository field.
up to date in 5.152s
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (bower-build) @ app ---
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (polymer-build) @ app ---
info: Clearing build/ directory...
info: (default) Building...
info: (default) Build complete!
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (test-list-files) @ app ---
bower.json
bower_components
images
index.html
manifest.json
src
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (move-files) @ app ---
cp: cannot stat 'dev-static/build/default/*': No such file or directory
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:804)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:751)
at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:313)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
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:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
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)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
我做了很多尝试使它工作,但没有任何帮助。
谢谢你的建议和帮助 我的猜测是,这一切的原因都是你的POM中的一个拼写错误:
<rgument>
这样,脚本程序的可读性就会提高。确保本地计算机和Jenkins上的settings.xml相同
将
-x
添加到您的mvn命令中,这样您就可以看到您正在使用的文件了谢谢,但是为什么maven没有为dtd验证打印错误呢?顺便说一句,在修复之后,我现在尝试让它建立在jenkins的基础上,然后我将进行一些重构,以获得maven的最佳实践。这个错误是真的吗?在错误发生的那一刻,目录/src/main/resources/dev static/build/default
,其中有文件吗?好吧,Maven不进行DTD验证,因为POM的结构无法事先确定:它可能包含许多插件,并且每个插件都有自己的格式…理论上,此目录存在,并且其中包含文件。在我的本地机器上测试期间,我可以断言。polymer cli创建build/default并在其中插入index.html以及连接和压缩的每个js和css文件。
<argument>
mkdir static
npm install
node_modules/.bin/bower
...