0

我的 VSTS Maven 构建定义在运行验证时需要参数。首先,我运行“mvn package verify -Dparam1 -Dparam2 -Dparam3”,它成功了。

但是,在“包验证”之后,VSTS 在最后使用 NO-Params 运行不需要的 mvn 验证,因此构建失败。

如何禁用最后验证或使验证使用 -DParams?

2018-02-12T13:32:34.8446308Z [INFO] jar verified.
2018-02-12T13:32:34.8446505Z [INFO] 
2018-02-12T13:32:34.8446714Z [INFO] Warning: 
2018-02-12T13:32:34.8446974Z [INFO] This jar contains entries whose signer certificate will expire within six months. 
2018-02-12T13:32:34.8447445Z [INFO] This jar contains signatures that does not include a timestamp. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (2018-05-10) or after any future revocation date.
2018-02-12T13:32:34.8624458Z [INFO] 1 archive(s) processed
2018-02-12T13:32:34.8664334Z [INFO] ------------------------------------------------------------------------
2018-02-12T13:32:34.8664665Z [INFO] BUILD SUCCESS
2018-02-12T13:32:34.8664921Z [INFO] ------------------------------------------------------------------------
2018-02-12T13:32:34.8665273Z [INFO] Total time: 50.332 s
2018-02-12T13:32:34.8665772Z [INFO] Finished at: 2018-02-12T13:32:34Z
2018-02-12T13:32:35.0258240Z [INFO] Final Memory: 25M/77M
2018-02-12T13:32:35.0258604Z [INFO] ------------------------------------------------------------------------
2018-02-12T13:32:35.1281485Z ##[warning]No test result files matching D:\a\1\s\**\TEST-*.xml were found, so publishing JUnit test results is being skipped.
2018-02-12T13:32:35.1287126Z [command]C:\Windows\system32\cmd.exe /D /S /C "C:\ProgramData\chocolatey\lib\maven\apache-maven-3.5.2\bin\mvn.cmd -f D:\a\1\s\DeepSpace\pom.xml -e verify"
2018-02-12T13:32:36.5980880Z [INFO] Error stacktraces are turned on.
2018-02-12T13:32:37.0120754Z [INFO] Scanning for projects...
2018-02-12T13:32:37.0122191Z [INFO] 
2018-02-12T13:32:37.0122686Z [INFO] ------------------------------------------------------------------------
2018-02-12T13:32:37.0123090Z [INFO] Building Deep Space Bootcamp Sample App 1.0-SNAPSHOT
2018-02-12T13:32:37.0123454Z [INFO] ------------------------------------------------------------------------
2018-02-12T13:32:37.2313342Z [INFO] 
2018-02-12T13:32:37.2473413Z [INFO] --- jacoco-maven-plugin:0.7.5.201505241946:prepare-agent (default-prepare-agent-vsts) @ DeepSpace ---
2018-02-12T13:32:37.8229516Z [INFO] argLine set to -javaagent:C:\\Users\\VssAdministrator\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.7.5.201505241946\\org.jacoco.agent-0.7.5.201505241946-runtime.jar=destfile=D:\\a\\1\\s\\DeepSpace\\CCReport43F6D5EF\\jacoco.exec,append=true,includes=**/*
2018-02-12T13:32:37.8232250Z [INFO] 
2018-02-12T13:32:37.8243561Z [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ DeepSpace ---
2018-02-12T13:32:38.0938866Z [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
2018-02-12T13:32:38.1169590Z [INFO] skip non existing resourceDirectory D:\a\1\s\DeepSpace\src\main\resources
2018-02-12T13:32:38.1170450Z [INFO] 
2018-02-12T13:32:38.1171013Z [INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ DeepSpace ---
2018-02-12T13:32:38.3437112Z [INFO] Changes detected - recompiling the module!
2018-02-12T13:32:38.3697582Z [WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
2018-02-12T13:32:38.3698751Z [INFO] Compiling 2 source files to D:\a\1\s\DeepSpace\target\classes
2018-02-12T13:32:39.0729521Z [INFO] 
2018-02-12T13:32:39.0730257Z [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ DeepSpace ---
2018-02-12T13:32:39.0730719Z [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
2018-02-12T13:32:39.0731177Z [INFO] skip non existing resourceDirectory D:\a\1\s\DeepSpace\src\test\resources
2018-02-12T13:32:39.0731542Z [INFO] 
2018-02-12T13:32:39.0732029Z [INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) @ DeepSpace ---
2018-02-12T13:32:39.0732400Z [INFO] No sources to compile
2018-02-12T13:32:39.0732698Z [INFO] 
2018-02-12T13:32:39.0733022Z [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ DeepSpace ---
2018-02-12T13:32:39.1385672Z [INFO] No tests to run.
2018-02-12T13:32:39.1385903Z [INFO] 
2018-02-12T13:32:39.1386162Z [INFO] --- jacoco-maven-plugin:0.7.5.201505241946:report (default-report-vsts) @ DeepSpace ---
2018-02-12T13:32:39.2812145Z [INFO] Skipping JaCoCo execution due to missing execution data file:D:\a\1\s\DeepSpace\CCReport43F6D5EF\jacoco.exec
2018-02-12T13:32:39.2812969Z [INFO] 
2018-02-12T13:32:39.2813268Z [INFO] --- maven-war-plugin:2.2:war (default-war) @ DeepSpace ---
2018-02-12T13:32:39.9302961Z [INFO] Packaging webapp
2018-02-12T13:32:39.9307139Z [INFO] Assembling webapp [DeepSpace] in [D:\a\1\s\DeepSpace\target\ROOT]
2018-02-12T13:32:39.9363446Z [INFO] Processing war project
2018-02-12T13:32:39.9363774Z [INFO] Copying webapp resources [D:\a\1\s\DeepSpace\src\main\webapp]
2018-02-12T13:32:39.9364767Z [INFO] Webapp assembled in [97 msecs]
2018-02-12T13:32:39.9365118Z [INFO] Building war: D:\a\1\s\DeepSpace\target\ROOT.war
2018-02-12T13:32:40.0857280Z [INFO] WEB-INF\web.xml already added, skipping
2018-02-12T13:32:40.2101112Z [INFO] 
2018-02-12T13:32:40.2102754Z [INFO] --- maven-jarsigner-plugin:1.4:sign (sign) @ DeepSpace ---
2018-02-12T13:32:40.2103952Z [INFO] Processing D:\a\1\s\DeepSpace\target\ROOT.war
2018-02-12T13:32:40.2105131Z [INFO] cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_162\jre\..\bin\jarsigner.exe" -verbose D:\a\1\s\DeepSpace\target\ROOT.war"
2018-02-12T13:32:40.4017265Z [WARNING] Please specify alias name
2018-02-12T13:32:40.4019368Z [INFO] 
2018-02-12T13:32:40.4022572Z [INFO] Please type jarsigner -help for usage
2018-02-12T13:32:40.4393736Z [INFO] ------------------------------------------------------------------------
2018-02-12T13:32:40.4405892Z [INFO] BUILD FAILURE
2018-02-12T13:32:40.4406558Z [INFO] ------------------------------------------------------------------------
2018-02-12T13:32:40.4406817Z [INFO] Total time: 3.818 s
2018-02-12T13:32:40.4407022Z [INFO] Finished at: 2018-02-12T13:32:40Z
2018-02-12T13:32:40.5885036Z [INFO] Final Memory: 26M/235M
2018-02-12T13:32:40.5885332Z [INFO] ------------------------------------------------------------------------
2018-02-12T13:32:40.5918635Z [ERROR] Failed to execute goal org.apache.maven.plugins:maven-jarsigner-plugin:1.4:sign (sign) on project DeepSpace: Failed executing 'cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_162\jre\..\bin\jarsigner.exe" -verbose D:\a\1\s\DeepSpace\target\ROOT.war"' - exitcode 1 -> [Help 1]
2018-02-12T13:32:40.5919455Z org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-jarsigner-plugin:1.4:sign (sign) on project DeepSpace: Failed executing 'cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_162\jre\..\bin\jarsigner.exe" -verbose D:\a\1\s\DeepSpace\target\ROOT.war"' - exitcode 1
2018-02-12T13:32:40.5921491Z     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
2018-02-12T13:32:40.5939247Z     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
2018-02-12T13:32:40.5957128Z     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
2018-02-12T13:32:40.5959542Z     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
2018-02-12T13:32:40.5960026Z     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
2018-02-12T13:32:40.5960410Z     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
2018-02-12T13:32:40.5960781Z     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
2018-02-12T13:32:40.5961161Z     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
2018-02-12T13:32:40.5961455Z     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
2018-02-12T13:32:40.5961914Z     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
2018-02-12T13:32:40.5962195Z     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
2018-02-12T13:32:40.5962488Z     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
2018-02-12T13:32:40.5962758Z     at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
2018-02-12T13:32:40.5963052Z     at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
2018-02-12T13:32:40.5963522Z     at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
2018-02-12T13:32:40.5963937Z     at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
2018-02-12T13:32:40.5964450Z     at java.lang.reflect.Method.invoke (Method.java:498)
2018-02-12T13:32:40.5964773Z     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
2018-02-12T13:32:40.5965079Z     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
2018-02-12T13:32:40.6224691Z     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
2018-02-12T13:32:40.6249419Z     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
2018-02-12T13:32:40.6288208Z Caused by: org.apache.maven.plugin.MojoExecutionException: Failed executing 'cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_162\jre\..\bin\jarsigner.exe" -verbose D:\a\1\s\DeepSpace\target\ROOT.war"' - exitcode 1
2018-02-12T13:32:40.6288674Z     at org.apache.maven.plugins.jarsigner.AbstractJarsignerMojo.processArchive (AbstractJarsignerMojo.java:515)
2018-02-12T13:32:40.6289042Z     at org.apache.maven.plugins.jarsigner.AbstractJarsignerMojo.processArtifact (AbstractJarsignerMojo.java:430)
2018-02-12T13:32:40.6289409Z     at org.apache.maven.plugins.jarsigner.AbstractJarsignerMojo.execute (AbstractJarsignerMojo.java:279)
2018-02-12T13:32:40.6289759Z     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
2018-02-12T13:32:40.6347074Z     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
2018-02-12T13:32:40.6347724Z     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
2018-02-12T13:32:40.6348176Z     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
2018-02-12T13:32:40.6348590Z     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
2018-02-12T13:32:40.6349038Z     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
2018-02-12T13:32:40.6349494Z     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
2018-02-12T13:32:40.6350215Z     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
2018-02-12T13:32:40.6350621Z     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
2018-02-12T13:32:40.6350987Z     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
2018-02-12T13:32:40.6351366Z     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
2018-02-12T13:32:40.6351725Z     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
2018-02-12T13:32:40.6381852Z     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
2018-02-12T13:32:40.6383168Z     at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
2018-02-12T13:32:40.6383507Z     at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
2018-02-12T13:32:40.6383849Z     at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
2018-02-12T13:32:40.6384195Z     at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
2018-02-12T13:32:40.6384491Z     at java.lang.reflect.Method.invoke (Method.java:498)
2018-02-12T13:32:40.6384810Z     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
2018-02-12T13:32:40.6385127Z     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
2018-02-12T13:32:40.6385425Z     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
2018-02-12T13:32:40.6385738Z     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
2018-02-12T13:32:40.6385988Z [ERROR] 
2018-02-12T13:32:40.6386369Z [ERROR] Re-run Maven using the -X switch to enable full debug logging.
2018-02-12T13:32:40.6386992Z [ERROR] 
2018-02-12T13:32:40.6387378Z [ERROR] For more information about the errors and possible solutions, please read the following articles:
2018-02-12T13:32:40.6432046Z [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
2018-02-12T13:32:40.7005380Z ##[warning]No code coverage found to publish. There might be a build failure resulting in no code coverage or there might be no tests.
2018-02-12T13:32:40.7006559Z ##[error]Build failed.
2018-02-12T13:32:40.7106641Z ##[section]Finishing: Maven DeepSpace/pom.xml
4

1 回答 1

1

根据源代码 ( maventask.ts) ,如果您使用 JaCoCo 工具启用代码覆盖率并且无法使用 JaCoco 工具为代码覆盖率添加其他参数,它会添加验证参数。

if (ccTool.toLowerCase() == "jacoco") {
            var mvnReport = tl.tool(mvnExec);
            mvnReport.arg('-f');
            if (tl.exist(reportPOMFile)) {
                // multi module project
                mvnReport.arg(reportPOMFile);
            }
            else {
                mvnReport.arg(mavenPOMFile);
            }
            mvnReport.line(mavenOptions);
            mvnReport.arg("verify");
            mvnReport.exec().then(function (code) {
                publishCCToTfs();
                defer.resolve(true);
            }).fail(function (err) {
                sendCodeCoverageEmptyMsg();
                defer.reject(err);
            });
        }
于 2018-02-13T04:14:35.887 回答