I'm working on a new plugin and when I try to run it I get the following error

16 afișări
Accesați primul mesaj necitit

Daniel Anechitoaie

necitită,
24 feb. 2020, 10:28:5524.02.2020
– Jenkins Developers
Hi,

I just started working on a new plugin and when I run mvn hpi:run I get the following error:

Failed while enforcing RequireUpperBoundDeps. The error(s) are [
Require upper bound dependencies error for org.slf4j:jcl-over-slf4j:1.7.25 paths to dependency are:
+-io.jenkins.plugins:my-plugin:1.0.0
  +-org.slf4j:jcl-over-slf4j:1.7.25
and
+-io.jenkins.plugins:my-plugin:1.0.0
  +-org.jenkins-ci.main:jenkins-core:2.204.2
    +-org.slf4j:jcl-over-slf4j:1.7.26
,
Require upper bound dependencies error for org.slf4j:log4j-over-slf4j:1.7.25 paths to dependency are:
+-io.jenkins.plugins:my-plugin:1.0.0
  +-org.slf4j:log4j-over-slf4j:1.7.25
and
+-io.jenkins.plugins:my-plugin:1.0.0
  +-org.jenkins-ci.main:jenkins-core:2.204.2
    +-org.slf4j:log4j-over-slf4j:1.7.26
,
Require upper bound dependencies error for org.slf4j:slf4j-jdk14:1.7.25 paths to dependency are:
+-io.jenkins.plugins:my-plugin:1.0.0
  +-org.slf4j:slf4j-jdk14:1.7.25
and
+-io.jenkins.plugins:my-plugin:1.0.0
  +-org.jenkins-ci.main:jenkins-war:2.204.2
    +-org.slf4j:slf4j-jdk14:1.7.26
]

Any idea what's going on and what I can do to fix this? 
I don't have any direct dependencies to org.slf4j

Here's my POM as well:

---
<?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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>3.6</version>
<relativePath />
</parent>

<groupId>io.jenkins.plugins</groupId>
<artifactId>my-plugin</artifactId>
<version>1.0.0</version>
<packaging>hpi</packaging>

<name>My Plugin</name>



<properties>
<jdk.version>1.8</jdk.version>
<java.level>8</java.level>
<jenkins.version>2.204.2</jenkins.version>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<optimize>true</optimize>
</configuration>
</plugin>
<plugin>
<groupId>org.jenkins-ci.tools</groupId>
<artifactId>maven-hpi-plugin</artifactId>
<configuration>
<pluginFirstClassLoader>true</pluginFirstClassLoader>
</configuration>
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>

<dependencies>
<!-- https://mvnrepository.com/artifact/org.jenkins-ci.plugins/structs -->
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
<version>1.17</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-text -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.8</version>
</dependency>

<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.codehaus.plexus/plexus-utils -->
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.3.0</version>
</dependency>

<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.12.2</version>
</dependency>
</dependencies>
</project>

Jesse Glick

necitită,
24 feb. 2020, 10:58:3924.02.2020
– Jenkins Dev
On Mon, Feb 24, 2020 at 10:29 AM Daniel Anechitoaie
<danie...@gmail.com> wrote:
> <parent>
> <groupId>org.jenkins-ci.plugins</groupId>
> <artifactId>plugin</artifactId>
> <version>3.6</version>

This is very old. Try using the latest 3.x, and for the newer LTS line
you may need to use a 4.0 beta.

Daniel Anechitoaie

necitită,
24 feb. 2020, 11:19:5124.02.2020
– Jenkins Developers
Hmm, yeah, I had a small brainfart. For some reason I was thinking in decimal and was seeing 3.6 as 3.60 which in my mind was more recent than 3.56 (which is the latest 3.x version)/

So now with 

<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
    <version>3.56</version>
<relativePath />
</parent>


And 

<properties>
<jdk.version>1.8</jdk.version>
<java.level>8</java.level>
    <jenkins.version>2.121.1</jenkins.version>
</properties>


I get

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project my-plugin: Compilation failure
[ERROR] java.nio.file.NoSuchFileException: /Users/daniels/Work/my-plugin/target/classes/META-INF/annotations/hudson.Extension

Should I just go to latest Jenkins and the 4.0 beta parent pom?

Mark Waite

necitită,
24 feb. 2020, 11:30:3924.02.2020
– jenkinsci-dev
On Mon, Feb 24, 2020 at 9:19 AM Daniel Anechitoaie <danie...@gmail.com> wrote:
Hmm, yeah, I had a small brainfart. For some reason I was thinking in decimal and was seeing 3.6 as 3.60 which in my mind was more recent than 3.56 (which is the latest 3.x version)/

So now with 

<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>3.56</version>
<relativePath />
</parent>


And 

<properties>
<jdk.version>1.8</jdk.version>
<java.level>8</java.level>
<jenkins.version>2.121.1</jenkins.version>
</properties>


I get

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project my-plugin: Compilation failure
[ERROR] java.nio.file.NoSuchFileException: /Users/daniels/Work/my-plugin/target/classes/META-INF/annotations/hudson.Extension

Should I just go to latest Jenkins and the 4.0 beta parent pom?


I receive that message when I'm compiling with Java 11 but using a Jenkins version before 2.164.  The first Jenkins LTS to support Java 11 compilation is Jenkins 2.164 (as far as I know)  I've learned to type:

$ mvn clean -Djenkins.version=2.164.3 verify

Eventually, I will update the plugins where I use that technique so that they require Jenkins 2.164 or newer as their minimum version.  Jenkins 2.164 is over a year old.  

Daniel Anechitoaie

necitită,
24 feb. 2020, 12:04:5724.02.2020
– Jenkins Developers
Yes, that was it. I'm compiling on OpenJDK 11.
Using <jenkins.version>2.164.1</jenkins.version> works now even with parent POM <version>3.56</version>

Thank you.

Jesse Glick

necitită,
24 feb. 2020, 13:35:3924.02.2020
– Jenkins Dev
On Mon, Feb 24, 2020 at 12:05 PM Daniel Anechitoaie
<danie...@gmail.com> wrote:
> I'm compiling on OpenJDK 11.

Best to use JDK 8 for all purposes related to Jenkins.

Daniel Anechitoaie

necitită,
24 feb. 2020, 13:37:5624.02.2020
– Jenkins Developers
Will do. Is OpenJDK ok? Or i need Oracle JDK?

Mark Waite

necitită,
24 feb. 2020, 13:51:4524.02.2020
– jenkinsci-dev
Adopt OpenJDK is widely used in the Jenkins project.  You're also welcome to use other OpenJDK implementations.  Licensing restrictions on recent Oracle JDK 8 versions have made it very rarely used in the Jenkins project.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/b925de42-af7a-4047-92bb-01b39b69d6a6%40googlegroups.com.
Răspundeți tuturor
Răspundeți autorului
Redirecționați
0 mesaje noi