plugin-pom 2.26 and above

126 views
Skip to first unread message

pallen

unread,
Jul 13, 2017, 8:54:29 AM7/13/17
to Jenkins Developers
Hi Guys,

I tried to update the P4 plugin to use the latest parent pom, but found a couple issues:

(1) version 2.26 and above seems to break mvn hpi:run

Running the following:

export MAVEN_OPTS="-Xmx2048m -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8008,suspend=n"
mvn clean hpi:run -Djetty.port=9090 -Pjenkins 

Listening for transport dt_socket at address: 8008
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building P4 Plugin 1.7.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ p4 ---
[INFO] Deleting /Users/pallen/Workspaces/main.p4-jenkins/public/target
[INFO] 
[INFO] >>> maven-hpi-plugin:1.121:run (default-cli) > compile @ p4 >>>
[INFO] 
[INFO] --- maven-hpi-plugin:1.121:validate (default-validate) @ p4 ---
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:display-info (display-info) @ p4 ---
[INFO] Maven Version: 3.3.9
[INFO] JDK Version: 1.8.0_66 normalized as: 1.8.0-66
[INFO] OS Info: Arch: x86_64 Family: mac Name: mac os x Version: 10.12.5
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (display-info) @ p4 ---
[INFO] 
[INFO] --- maven-localizer-plugin:1.24:generate (default) @ p4 ---
[INFO] 
[INFO] >>> maven-javadoc-plugin:2.10.4:javadoc (default) > generate-sources @ p4 >>>
[INFO] 
[INFO] --- maven-hpi-plugin:1.121:validate (default-validate) @ p4 ---
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:display-info (display-info) @ p4 ---
[INFO] Maven Version: 3.3.9
[INFO] JDK Version: 1.8.0_66 normalized as: 1.8.0-66
[INFO] OS Info: Arch: x86_64 Family: mac Name: mac os x Version: 10.12.5
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (display-info) @ p4 ---
[INFO] 
[INFO] --- maven-localizer-plugin:1.24:generate (default) @ p4 ---
[INFO] 
[INFO] <<< maven-javadoc-plugin:2.10.4:javadoc (default) < generate-sources @ p4 <<<
[INFO] 
[INFO] --- maven-javadoc-plugin:2.10.4:javadoc (default) @ p4 ---
[INFO] 
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ p4 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 116 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) @ p4 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 134 source files to /Users/pallen/Workspaces/main.p4-jenkins/public/target/classes
[INFO] /Users/pallen/Workspaces/main.p4-jenkins/public/src/main/java/org/jenkinsci/plugins/p4/workflow/P4CleanupStep.java: Some input files use or override a deprecated API.
[INFO] /Users/pallen/Workspaces/main.p4-jenkins/public/src/main/java/org/jenkinsci/plugins/p4/workflow/P4CleanupStep.java: Recompile with -Xlint:deprecation for details.
[INFO] /Users/pallen/Workspaces/main.p4-jenkins/public/src/main/java/org/jenkinsci/plugins/p4/client/ClientHelper.java: Some input files use unchecked or unsafe operations.
[INFO] /Users/pallen/Workspaces/main.p4-jenkins/public/src/main/java/org/jenkinsci/plugins/p4/client/ClientHelper.java: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] <<< maven-hpi-plugin:1.121:run (default-cli) < compile @ p4 <<<
[INFO] 
[INFO] --- maven-hpi-plugin:1.121:run (default-cli) @ p4 ---
[INFO] Logging initialized @17800ms
[WARNING] Please use `webApp/contextPath` configuration parameter in place of the deprecated `contextPath` parameter
[INFO] Generating /Users/pallen/Workspaces/main.p4-jenkins/public/work/plugins/p4.hpl
[INFO] Copying dependency Jenkins plugin /Users/pallen/.m2/repository/org/jenkins-ci/plugins/script-security/1.25/script-security-1.25.hpi
[INFO] Copying dependency Jenkins plugin ...SNIP...
[INFO] Copying dependency Jenkins plugin /Users/pallen/.m2/repository/org/jenkinsci/plugins/pipeline-model-definition/1.0/pipeline-model-definition-1.0.hpi
[INFO] Configuring Jetty for project: P4 Plugin
[INFO] /Users/pallen/Workspaces/main.p4-jenkins/public/target/tmp/webapp does not yet exist, will receive null
[INFO] Context path = /jenkins
[INFO] Tmp directory = /Users/pallen/Workspaces/main.p4-jenkins/public/target/tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] Jetty server exiting.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.377 s
[INFO] Finished at: 2017-07-13T13:46:02+01:00
[INFO] Final Memory: 56M/779M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jenkins-ci.tools:maven-hpi-plugin:1.121:run (default-cli) on project p4: Failure: NullPointerException -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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:



(2) version 2.31 seems to have introduced extra dependancies:

[WARNING] Rule 5: org.apache.maven.plugins.enforcer.RequireUpperBoundDeps failed with message:
Failed while enforcing RequireUpperBoundDeps. The error(s) are [
Require upper bound dependencies error for com.jcraft:jzlib:1.1.3 paths to dependency are:
+-org.jenkins-ci.plugins:p4:1.7.2-SNAPSHOT
  +-com.perforce:p4java:2017.2.1530813
    +-com.jcraft:jzlib:1.1.3
and
+-org.jenkins-ci.plugins:p4:1.7.2-SNAPSHOT
  +-org.jenkins-ci.main:jenkins-core:1.642.3
    +-com.jcraft:jzlib:1.1.3-kohsuke-1
and
+-org.jenkins-ci.plugins:p4:1.7.2-SNAPSHOT
  +-org.jenkins-ci.main:jenkins-core:1.642.3
    +-org.kohsuke.stapler:stapler-jrebel:1.237
      +-org.kohsuke.stapler:stapler:1.237
        +-com.jcraft:jzlib:1.1.3
Require upper bound dependencies error for org.jenkins-ci.plugins:branch-api:1.10 paths to dependency are:
+-org.jenkins-ci.plugins:p4:1.7.2-SNAPSHOT
  +-org.jenkins-ci.plugins:branch-api:1.10
and
+-org.jenkins-ci.plugins:p4:1.7.2-SNAPSHOT
  +-org.jenkins-ci.plugins.workflow:workflow-aggregator:2.5
    +-org.jenkins-ci.plugins.workflow:workflow-multibranch:2.9.2
      +-org.jenkins-ci.plugins:branch-api:1.11
Require upper bound dependencies error for org.apache.commons:commons-compress:1.9 paths to dependency are:
+-org.jenkins-ci.plugins:p4:1.7.2-SNAPSHOT
  +-org.apache.commons:commons-compress:1.9
and
+-org.jenkins-ci.plugins:p4:1.7.2-SNAPSHOT
  +-org.jenkins-ci.main:jenkins-core:1.642.3
    +-org.apache.commons:commons-compress:1.10
]



Kind regards,
Paul

Jesse Glick

unread,
Jul 13, 2017, 9:50:32 AM7/13/17
to Jenkins Dev
On Thu, Jul 13, 2017 at 8:54 AM, pallen <pal...@perforce.com> wrote:
> [ERROR] Failed to execute goal
> org.jenkins-ci.tools:maven-hpi-plugin:1.121:run (default-cli) on project p4:
> Failure: NullPointerException -> [Help 1]

Meaningless because you did not read:

> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e
> switch.

which would indicate which plugin failed and why.

> (2) version 2.31 seems to have introduced extra dependancies:
>
> [WARNING] Rule 5: org.apache.maven.plugins.enforcer.RequireUpperBoundDeps
> failed with message:
> Failed while enforcing RequireUpperBoundDeps. The error(s) are [
> Require upper bound dependencies error for com.jcraft:jzlib:1.1.3 paths to
> dependency are:
> +-org.jenkins-ci.plugins:p4:1.7.2-SNAPSHOT
> +-com.perforce:p4java:2017.2.1530813
> +-com.jcraft:jzlib:1.1.3
> and
> +-org.jenkins-ci.plugins:p4:1.7.2-SNAPSHOT
> +-org.jenkins-ci.main:jenkins-core:1.642.3
> +-com.jcraft:jzlib:1.1.3-kohsuke-1
> and
> +-org.jenkins-ci.plugins:p4:1.7.2-SNAPSHOT
> +-org.jenkins-ci.main:jenkins-core:1.642.3
> +-org.kohsuke.stapler:stapler-jrebel:1.237
> +-org.kohsuke.stapler:stapler:1.237
> +-com.jcraft:jzlib:1.1.3

It did not introduce dependencies; it starts preventing you from
messing up existing dependencies. Here it shows that your plugin is
attempting to declare a dependency on jzlib but Jenkins core already
bundles a patched version. Thus you should use `<excludes>` to ignore
the version coming in from `p4java`. (Unless you are deliberately
using `pluginFirstClassLoader`, and you really really really know what
you are doing, in which case your POM can declare an exemption to this
violation.)

> Require upper bound dependencies error for
> org.jenkins-ci.plugins:branch-api:1.10 paths to dependency are:
> +-org.jenkins-ci.plugins:p4:1.7.2-SNAPSHOT
> +-org.jenkins-ci.plugins:branch-api:1.10
> and
> +-org.jenkins-ci.plugins:p4:1.7.2-SNAPSHOT
> +-org.jenkins-ci.plugins.workflow:workflow-aggregator:2.5
> +-org.jenkins-ci.plugins.workflow:workflow-multibranch:2.9.2
> +-org.jenkins-ci.plugins:branch-api:1.11

So you need to update your dep to at least 1.11.

> Require upper bound dependencies error for
> org.apache.commons:commons-compress:1.9 paths to dependency are:
> +-org.jenkins-ci.plugins:p4:1.7.2-SNAPSHOT
> +-org.apache.commons:commons-compress:1.9
> and
> +-org.jenkins-ci.plugins:p4:1.7.2-SNAPSHOT
> +-org.jenkins-ci.main:jenkins-core:1.642.3
> +-org.apache.commons:commons-compress:1.10

Again your plugin is apparently attempting to bundle an older version
of this library than Jenkins core already provides.

Jesse Glick

unread,
Jul 13, 2017, 10:15:14 AM7/13/17
to Jenkins Dev
[last message was dropped from the list]

On Thu, Jul 13, 2017 at 10:04 AM, Paul Allen <pal...@perforce.com> wrote:
> Ok I see the addition of requireUpperBoundDeps in 2.31 - I can fix the dependancy issue, I guess they were always there, but hidden.

Yes.

> Caused by: java.lang.NullPointerException
> at org.jenkinsci.maven.plugins.hpi.RunMojo.configureWebApplication(RunMojo.java:460)

No idea what that would mean. I tried

git pull && mvn -DskipTests clean package hpi:run

and it worked for me.
Reply all
Reply to author
Forward
0 new messages