В настоящее время у меня работает новый сервер Jenkins, начиная с версии 2.128 до 2.222. У меня есть несколько проектов, которые терпят неудачу с одной и той же ошибкой из-за проблемы связи с моим SCM через Maven. Вот ошибка:
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ drizzlesizzle ---
[DEBUG] Skipping non-existing directory /var/jenkins_home/workspace/drizzlesizzle-laurenc/target
[DEBUG] Skipping non-existing directory /var/jenkins_home/workspace/drizzlesizzle-laurenc/target/classes
[DEBUG] Skipping non-existing directory /var/jenkins_home/workspace/drizzlesizzle-laurenc/target/test-classes
[DEBUG] Skipping non-existing directory /var/jenkins_home/workspace/drizzlesizzle-laurenc/target/site
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-jackson-versions) @ drizzlesizzle ---
[DEBUG] Executing rule: org.apache.maven.plugins.enforcer.RequireSameVersions
[INFO]
[INFO] --- buildnumber-maven-plugin:1.4:create (default) @ drizzlesizzle ---
[DEBUG] Verifying there are no local modifications ...
[DEBUG] info
[DEBUG] Command completed in 37ms
[DEBUG] clients -m2147483647 -up4-daemon
[DEBUG] Command completed in 38ms
[DEBUG] Perforce password (P4PASSWD) invalid or unset.
[ERROR] Perforce password (P4PASSWD) invalid or unset.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.578 s
[INFO] Finished at: 2020-04-08T22:05:54+00:00
[INFO] Final Memory: 27M/188M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.4:create (default) on project drizzlesizzle: An error has occurred while checking scm status. Unable to discover client: Perforce password (P4PASSWD) invalid or unset. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.4:create (default) on project drizzlesizzle: An error has occurred while checking scm status.
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.jvnet.hudson.maven3.launcher.Maven33Launcher.main(Maven33Launcher.java:129)
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.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven33Main.launch(Maven33Main.java:178)
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 hudson.maven.Maven3Builder.call(Maven3Builder.java:139)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:70)
at hudson.remoting.UserRequest.perform(UserRequest.java:211)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:369)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.maven.plugin.MojoExecutionException: An error has occurred while checking scm status.
at org.codehaus.mojo.build.CreateMojo.checkForLocalModifications(CreateMojo.java:479)
at org.codehaus.mojo.build.CreateMojo.execute(CreateMojo.java:365)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 31 more
Caused by: org.apache.maven.scm.ScmException: Unable to discover client
at com.perforce.maven.scm.provider.p4.manager.DefaultP4ClientManager.getClient(DefaultP4ClientManager.java:151)
at com.perforce.maven.scm.provider.p4.manager.DefaultP4ClientManager.getClient(DefaultP4ClientManager.java:75)
at com.perforce.maven.scm.provider.p4.P4ScmProvider.login(P4ScmProvider.java:264)
at org.apache.maven.scm.provider.AbstractScmProvider.login(AbstractScmProvider.java:747)
at org.apache.maven.scm.provider.AbstractScmProvider.status(AbstractScmProvider.java:789)
at org.codehaus.mojo.build.CreateMojo.getStatus(CreateMojo.java:544)
at org.codehaus.mojo.build.CreateMojo.checkForLocalModifications(CreateMojo.java:475)
... 34 more
Caused by: org.apache.maven.scm.ScmException: Unable to discover client
at com.perforce.maven.scm.provider.p4.manager.DefaultP4ClientManager.discoverClientName(DefaultP4ClientManager.java:402)
at com.perforce.maven.scm.provider.p4.manager.DefaultP4ClientManager.getClient(DefaultP4ClientManager.java:90)
... 40 more
Caused by: com.perforce.p4java.exception.RequestException: Perforce password (P4PASSWD) invalid or unset.
at com.perforce.p4java.impl.mapbased.server.Server.getClients(Server.java:1003)
at com.perforce.p4java.impl.mapbased.server.Server.getClients(Server.java:969)
at com.perforce.maven.scm.provider.p4.manager.DefaultP4ClientManager.discoverClientName(DefaultP4ClientManager.java:364)
... 41 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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/MojoExecutionException
Это происходит, когда у меня установлены параметры сборки / целей и параметров Jenkins для "-X --update-snapshots clean verify". Я заметил, что у всех проектов, которые терпят неудачу с этим, есть тот же самый тег scm в их pom. xml. Вот один из этих poms:
<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>
<parent>
<groupId>com.sustaining</groupId>
<artifactId>sustaining-parent-pom</artifactId>
<version>1.2-SNAPSHOT</version>
</parent>
<artifactId>drizzlesizzle</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>drizzlesizzle</name>
<properties>
<mock-server.version>3.10.4</mock-server.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>create-uber-jar</id>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>com.sustaining.drizzlesizzle.server.DrizzlesizzleStarter</Main-Class>
<Class-Path>.</Class-Path>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<id>enforce-jackson-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireSameVersions>
<dependencies>
<dependency>com.fasterxml.jackson.core.jackson-annotations</dependency>
<dependency>com.fasterxml.jackson.datatype:jackson-datatype-jsr310</dependency>
</dependencies>
</requireSameVersions>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- project specific -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>com.sustaining.util</groupId>
<artifactId>CommandExecutor</artifactId>
<version>0.0.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sustaining.core</groupId>
<artifactId>CoReClient</artifactId>
<version>1.1.0.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>com.sustaining.util</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sustaining.util</groupId>
<artifactId>jar-extractor</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sustaining.util</groupId>
<artifactId>unzipper</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sustaining.can</groupId>
<artifactId>cancommand2</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sustaining.can</groupId>
<artifactId>CanClient2</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>
<!-- Jersey -->
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-grizzly2-servlet</artifactId>
</dependency>
<!-- JSON with Jackson -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.5.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.8</version>
</dependency>
<!-- Swagger API docs -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jersey2-jaxrs</artifactId>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
<artifactId>jersey-test-framework-provider-bundle</artifactId>
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.meanbean</groupId>
<artifactId>meanbean</artifactId>
<version>2.0.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-netty</artifactId>
<version>${mock-server.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>logback-classic</artifactId>
<groupId>ch.qos.logback</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<description>A Java service that exposes a RESTful interface to talk to tape drives, usually with ITDT.</description>
<scm>
<connection>scm:p4:perforce.domain.com:1666://Sustaining/drizzletizzle-standard-test/drizzlesizzle</connection>
<developerConnection>scm:p4:perforce.domain.com:1666://Sustaining/drizzletizzle-standard-test/drizzlesizzle</developerConnection>
<url>http://perforce.domain.com:8080/@md=d&cd=//Sustaining/hptizzle/&c=ZSb@//Sustaining/drizzletizzle/drizzlesizzle/?ac=83</url>
</scm>
<issueManagement>
<system>JIRA</system>
<url>https://jira.domain.com/projects/SUSDT/issues</url>
</issueManagement>
<ciManagement>
<system>Jenkins</system>
<url>http://works:8888/job/drizzlesizzle/</url>
</ciManagement>
<!-- Jenkins build plugins, for static code analysis -->
<profiles>
<!-- Jenkins by default defines a property BUILD_NUMBER which is used to enable the profile. -->
<profile>
<id>jenkins</id>
<activation>
<property>
<name>env.BUILD_NUMBER</name>
</property>
</activation>
<build>
<plugins>
<!-- JaCoCo coverage -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<!-- Run Checkstyle -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<!-- Run FindBugs -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
</plugin>
<!-- Run PMD and the copy paste detector -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
</plugin>
<!-- Attach Javadocs -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
У меня есть 8 проектов, которые терпят неудачу из-за этой ошибки, и все они имеют одинаковый синтаксис SCM:
<scm>
<connection>scm:p4:perforce.domain.com:1666://Sustaining/drizzletizzle-standard-test/drizzlesizzle</connection>
<developerConnection>scm:p4:perforce.domain.com:1666://Sustaining/drizzletizzle-standard-test/drizzlesizzle</developerConnection>
<url>http://perforce.domain.com:8080/@md=d&cd=//Sustaining/hptizzle/&c=ZSb@//Sustaining/drizzletizzle/drizzlesizzle/?ac=83</url>
</scm>
У меня есть несколько проектов, которые на SVN, которые не имеют этой проблемы. У меня также есть пара десятков проектов, которые вообще не используют опцию плагина maven scm, и они могут нормально подключаться к моему серверу Perforce. Я попытался изменить форматирование соединений (изменив p4 на Perforce, который затем потерпел неудачу из-за пропущенного пароля), полностью удалив scm и добавив в pom buildnumber-maven-plugin.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<dependencies>
<dependency>
<groupId>com.perforce.p4maven</groupId>
<artifactId>p4maven-provider</artifactId>
<version>${p4maven.version}</version>
</dependency>
</dependencies>
</plugin>