Managed to fix it.
A project dependency was requiring guava 18.0, but jenkis-core was fetching 
11.0.1. To fix it I had to exclude guava from jenkins-core:
    <dependency>
        <groupId>org.jenkins-ci.main</groupId>
        <artifactId>jenkins-core</artifactId>
        <exclusions>
            <exclusion>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
            </exclusion>
        </exclusions>
        <scope>provided</scope>
    </dependency>

From: 'Claudiu Guiman' via Jenkins Developers 
[mailto:jenkinsci-dev@googlegroups.com]
Sent: Monday, January 9, 2017 09:33
To: jenkinsci-dev@googlegroups.com
Subject: Need help configuring the pom.xml so I can have integration tests

Hi,
I’m trying to add integration tests in my plugin and I want them to be optional 
and only be triggered if you run a specific maven step.
To accomplish this I added a dependency to the maven failsafe plugin and now I 
need to run “mvn failsafe:integration-test” to run my specific integration 
tests.
So far so good, but when I need to execute some code that depends on jenkins 
I’m getting NoClassDefFoundError exceptions. I managed to fix some of these by 
adding a dependency to the jenkins-test-harness, but now I’m hitting one I 
can’t fix: “java.lang.NoClassDefFoundError: 
com/google/common/reflect/TypeToken”. The exception is due to the fact that I 
don’t have a direct dependency to google guava, but the jenkins-core should 
bring that into my classpath, but even if I add the jenkins-core as a 
dependency within the “test” scope I can’t manage to fix it.
Here’s the pom file portion in question:
<dependency>
        <groupId>org.jenkins-ci.main</groupId>
        <artifactId>jenkins-test-harness</artifactId>
        <scope>test</scope>
</dependency>
<dependency>
        <groupId>org.jenkins-ci.main</groupId>
        <artifactId>jenkins-core</artifactId>
        <scope>provided</scope>
</dependency>

I’m using “provided” scope right now because that’s what Maven recommends: 
https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmaven.apache.org%2Fguides%2Fintroduction%2Fintroduction-to-dependency-mechanism.html%23Dependency_Scope&data=02%7C01%7Cclguiman%40microsoft.com%7C32bf7fe0fb5d445ede3308d438b584f3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636195799650561529&sdata=U4tMOQTiEt1pOCiCRlKlVIJD8xElcsN63UF5Fydnvvk%3D&reserved=0>
Can someone help me understand what I’m doing wrong and how I should fix the 
pom file?

Thanks,
Claudiu
--
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-dev+unsubscr...@googlegroups.com<mailto:jenkinsci-dev+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CY1PR0301MB1660D6BE07AB975399F2AFD2D7640%40CY1PR0301MB1660.namprd03.prod.outlook.com<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fjenkinsci-dev%2FCY1PR0301MB1660D6BE07AB975399F2AFD2D7640%2540CY1PR0301MB1660.namprd03.prod.outlook.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=02%7C01%7Cclguiman%40microsoft.com%7C32bf7fe0fb5d445ede3308d438b584f3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636195799650561529&sdata=gtNIifvVTC6zDk0hFrYG3D8Wct0ZA7k94kpbgTDVf8k%3D&reserved=0>.
For more options, visit 
https://groups.google.com/d/optout<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Foptout&data=02%7C01%7Cclguiman%40microsoft.com%7C32bf7fe0fb5d445ede3308d438b584f3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636195799650561529&sdata=d7nvh%2FOtta%2FfLiCxxMPyTJT3UTEgLj7n6SeMt0JOkxs%3D&reserved=0>.

-- 
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-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CY1PR0301MB166079D40CEC884CB01531EFD7670%40CY1PR0301MB1660.namprd03.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to