Quantcast

Jenkins plugin and External libraries

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Jenkins plugin and External libraries

alecharp
Hi,

I'm developing a small plugin and I need to use xpath to parse xml
files. I added jdom in the pom but I still have the
NoClassDefFoundError when running my plugin.

I saw an old issue about this (http://java.net/projects/hudson/lists/
users/archive/2008-02/message/368), but nothing about a resolution.
I thought about putting the jar in the hudson classpath but it can't
be a long-term solution.

Is anyone know the solution?

regards,
Adrien
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Jenkins plugin and External libraries

alecharp
There is no way to use JDOM XPath in Jenkins or any other library in a plugin?

--
Adrien Lecharpentier


2011/4/7 alecharp <[hidden email]>
Hi,

I'm developing a small plugin and I need to use xpath to parse xml
files. I added jdom in the pom but I still have the
NoClassDefFoundError when running my plugin.

I saw an old issue about this (<a href="http://java.net/projects/hudson/lists/ users/archive/2008-02/message/368" target="_blank">http://java.net/projects/hudson/lists/
users/archive/2008-02/message/368), but nothing about a resolution.
I thought about putting the jar in the hudson classpath but it can't
be a long-term solution.

Is anyone know the solution?

regards,
Adrien

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Jenkins plugin and External libraries

vimil saju-2

Doesn't JDK 1.5 have built-in support for xslt parsing? Do you need jdom.jar?

On Fri, Apr 15, 2011 at 1:31 AM, Adrien Lecharpentier <[hidden email]> wrote:
There is no way to use JDOM XPath in Jenkins or any other library in a plugin?

--
Adrien Lecharpentier



2011/4/7 alecharp <[hidden email]>
Hi,

I'm developing a small plugin and I need to use xpath to parse xml
files. I added jdom in the pom but I still have the
NoClassDefFoundError when running my plugin.

I saw an old issue about this (http://java.net/projects/hudson/lists/
users/archive/2008-02/message/368
), but nothing about a resolution.
I thought about putting the jar in the hudson classpath but it can't
be a long-term solution.

Is anyone know the solution?

regards,
Adrien


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Jenkins plugin and External libraries

jieryn
Greetings,

On Sat, Apr 16, 2011 at 1:17 PM, vimil saju <[hidden email]> wrote:
>
> Doesn't JDK 1.5 have built-in support for xslt parsing? Do you need
> jdom.jar?

More importantly though... why doesn't the original poster simply
declare his/her plugin dependencies correctly in the first place[1]?
Unless there has been a very serious regression in the HPI plugin,
this smells of user error.

>>> I'm developing a small plugin and I need to use xpath to parse xml
>>> files. I added jdom in the pom but I still have the
>>> NoClassDefFoundError when running my plugin.

[1] http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

-Jesse

--
There are 10 types of people in this world, those
that can read binary and those that can not.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Jenkins plugin and External libraries

alecharp
Hello,

well, maybe I don't find what you meant but here is my pom
declaration:
<dependencies>
        <dependency>
                <groupId>org.jdom</groupId>
                <artifactId>jdom</artifactId>
                <version>1.1</version>
        </dependency>
</dependencies>

and I'm still having this error: java.lang.NoClassDefFoundError: org/
jdom/Parent: org/jdom/Parent

Regards,
Adrien

On 16 avr, 16:40, Jesse Farinacci <[hidden email]> wrote:

> Greetings,
>
> On Sat, Apr 16, 2011 at 1:17 PM, vimil saju <[hidden email]> wrote:
>
> > Doesn't JDK 1.5 have built-in support for xslt parsing? Do you need
> > jdom.jar?
>
> More importantly though... why doesn't the original poster simply
> declare his/her plugin dependencies correctly in the first place[1]?
> Unless there has been a very serious regression in the HPI plugin,
> this smells of user error.
>
> >>> I'm developing a small plugin and I need to use xpath to parse xml
> >>> files. I added jdom in the pom but I still have the
> >>> NoClassDefFoundError when running my plugin.
>
> [1]http://maven.apache.org/guides/introduction/introduction-to-dependenc...
>
> -Jesse
>
> --
> There are 10 types of people in this world, those
> that can read binary and those that can not.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Jenkins plugin and External libraries

jieryn
Greetings,

On Mon, Apr 18, 2011 at 8:02 AM, alecharp
<[hidden email]> wrote:

> well, maybe I don't find what you meant but here is my pom
> declaration:
> <dependencies>
>        <dependency>
>                <groupId>org.jdom</groupId>
>                <artifactId>jdom</artifactId>
>                <version>1.1</version>
>        </dependency>
> </dependencies>
>
> and I'm still having this error: java.lang.NoClassDefFoundError: org/
> jdom/Parent: org/jdom/Parent

Well, to solve this more information is required. You should post your
pom.xml and how are you invoking your plugin to trigger this issue?
What about the results of mvn dependency:analyze?

-Jesse

--
There are 10 types of people in this world, those
that can read binary and those that can not.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Jenkins plugin and External libraries

kohsuke Kawaguchi (CB)

Yes, adding additional jars to a plugin is very well supported, and
there are many many plugins that use that feature, so it's hard to
imagine that it's down right broken.

To add to the list from Jesse,

  1. Please share the whole stack trace, not just the top of the line
  2. Please verify the contents of the hpi file and confirm that jdom
     jar is in WEB-INF/lib.

On 04/21/2011 06:03 PM, Jesse Farinacci wrote:

> Greetings,
>
> On Mon, Apr 18, 2011 at 8:02 AM, alecharp
> <[hidden email]>  wrote:
>>  well, maybe I don't find what you meant but here is my pom
>>  declaration:
>>  <dependencies>
>>          <dependency>
>>                  <groupId>org.jdom</groupId>
>>                  <artifactId>jdom</artifactId>
>>                  <version>1.1</version>
>>          </dependency>
>>  </dependencies>
>>
>>  and I'm still having this error: java.lang.NoClassDefFoundError: org/
>>  jdom/Parent: org/jdom/Parent
>
> Well, to solve this more information is required. You should post your
> pom.xml and how are you invoking your plugin to trigger this issue?
> What about the results of mvn dependency:analyze?
>
> -Jesse
>


--
Kohsuke Kawaguchi | CloudBees, Inc. | http://cloudbees.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Jenkins plugin and External libraries

alecharp
Hi,

so my pom.xml: 
<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.jvnet.hudson.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.350</version>
</parent>
<groupId>com.alcatel_lucent.prod.plugins.hudson</groupId>
<artifactId>klocwork-report</artifactId>
<name>Klocwork Report Plugin for Hudson</name>
<version>1.0.7-SNAPSHOT</version>
<packaging>hpi</packaging>
<description>
Enable to get information from a klocwork analys. 
Parsing a xml result file, generated by maven-klocwork-plugin and a 
klocwork command line. Also permit to add a direct link to the project 
root of the klocwork report onto the klocwork server.
</description>
<url />
<scm>
<connection>**</connection>
<developerConnection>**</developerConnection>
</scm>
<ciManagement>
<system>hudson</system>
<url>**</url>
</ciManagement>
<licenses>
<license>
<name>Alcatel-Lucent, 2010</name>
</license>
</licenses>
<dependencies>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0-beta-1</version>
</plugin>
</plugins>
</build>
<developers>
<developer>
<id>alecharp</id>
<name>Adrien Lecharpentier</name>
<email>[hidden email]</email>
</developer>
</developers>
<distributionManagement>
<repository>
<id>**</id>
<url>**</url>
</repository>
<snapshotRepository>
<id>**</id>
<url>**</url>
</snapshotRepository>
</distributionManagement>
</project>

to invoke this issue: 
SAXBuilder sxb = new SAXBuilder();
Document doc = sxb.build(input);
Element root = doc.getRootElement();
XPath xpa = XPath.newInstance("//klocwork:severity");
xpa.addNamespace("klocwork", XMLNS);

mvn dependency:analyse:
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.alcatel_lucent.prod.plugins.hudson:klocwork-report:hpi:1.0.7-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ org.jvnet.hudson:hudson:1.7, D:\Documents and Settings\alecharp\.m2\home-repo\org\jvnet\hudson\hudson\1.7\hudson-1.7.pom, line 81, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ org.jvnet.hudson.plugins:plugin:1.350, D:\Documents and Settings\alecharp\.m2\home-repo\org\jvnet\hudson\plugins\plugin\1.350\plugin-1.350.pom, line 179, column 15
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Klocwork Report Plugin for Hudson 1.0.7-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report >>>
[INFO] 
[INFO] --- maven-enforcer-plugin:1.0-beta-1:display-info (default) @ klocwork-report ---
[INFO] Maven Version: 3.0.3
[INFO] JDK Version: 1.6.0_24 normalized as: 1.6.0-24
[INFO] OS Info: Arch: x86 Family: windows Name: windows xp Version: 5.1
[INFO] 
[INFO] --- maven-localizer-plugin:1.8:generate (default) @ klocwork-report ---
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ klocwork-report ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 9 resources
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:apt-compile (default-apt-compile) @ klocwork-report ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:insert-test (default-insert-test) @ klocwork-report ---
[INFO] 
[INFO] --- gmaven-plugin:1.0-rc-5:generateTestStubs (test-in-groovy) @ klocwork-report ---
[INFO]  No sources found for Java stub generation
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ klocwork-report ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\myFactory\hudson\plugins_hudson\klocwork-report\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ klocwork-report ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:test-hpl (default-test-hpl) @ klocwork-report ---
[INFO] Generating D:\myFactory\hudson\plugins_hudson\klocwork-report\target\test-classes\the.hpl
[INFO] 
[INFO] --- gmaven-plugin:1.0-rc-5:testCompile (test-in-groovy) @ klocwork-report ---
[INFO]  No sources found to compile
[INFO] 
[INFO] <<< maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report <<<
[INFO] 
[INFO] --- maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report ---
[WARNING] Used undeclared dependencies found:
[WARNING]    org.kohsuke.stapler:json-lib:jar:2.1-rev6:provided
[WARNING]    jfree:jcommon:jar:1.0.12:provided
[WARNING]    jfree:jfreechart:jar:1.0.9:provided
[WARNING]    org.kohsuke.stapler:stapler:jar:1.137:provided
[WARNING] Unused declared dependencies found:
[WARNING]    org.jvnet.hudson.main:hudson-war:war:1.350:test
[WARNING]    javax.servlet:servlet-api:jar:2.4:provided
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.703s
[INFO] Finished at: Fri Apr 22 09:08:58 CEST 2011
[INFO] Final Memory: 10M/24M
[INFO] ------------------------------------------------------------------------

stacktrace:
org.jdom.JDOMException: java.lang.NoClassDefFoundError: org/jdom/Parent: org/jdom/Parent
at org.jdom.xpath.XPath.newInstance(XPath.java:146)
at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parse(KlocworkParser.java:58)
at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parser(KlocworkParser.java:35)
at com.alcatel_lucent.prod.plugins.hudson.KlocworkReportRecorder.perform(KlocworkReportRecorder.java:122)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:563)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:550)
at hudson.model.Build$RunnerImpl.post2(Build.java:152)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)
at hudson.model.Run.run(Run.java:1263)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:122)
Caused by: java.lang.NoClassDefFoundError: org/jdom/Parent
at org.jaxen.jdom.JDOMXPath.<init>(JDOMXPath.java:91)
at org.jdom.xpath.JaxenXPath.setXPath(JaxenXPath.java:281)
at org.jdom.xpath.JaxenXPath.<init>(JaxenXPath.java:99)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.jdom.xpath.XPath.newInstance(XPath.java:137)
... 13 more
Caused by: java.lang.ClassNotFoundException: org.jdom.Parent
at java.lang.ClassLoader.findClass(ClassLoader.java:359)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at org.jvnet.hudson.maven.plugins.hpi.MaskingClassLoader.loadClass(MaskingClassLoader.java:22)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:325)
... 21 more
Caused by: java.lang.NoClassDefFoundError: org/jdom/Parent
at org.jaxen.jdom.JDOMXPath.<init>(JDOMXPath.java:91)
at org.jdom.xpath.JaxenXPath.setXPath(JaxenXPath.java:281)
at org.jdom.xpath.JaxenXPath.<init>(JaxenXPath.java:99)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.jdom.xpath.XPath.newInstance(XPath.java:137)
at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parse(KlocworkParser.java:58)
at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parser(KlocworkParser.java:35)
at com.alcatel_lucent.prod.plugins.hudson.KlocworkReportRecorder.perform(KlocworkReportRecorder.java:122)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:563)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:550)
at hudson.model.Build$RunnerImpl.post2(Build.java:152)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)
at hudson.model.Run.run(Run.java:1263)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:122)
Caused by: java.lang.ClassNotFoundException: org.jdom.Parent
at java.lang.ClassLoader.findClass(ClassLoader.java:359)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at org.jvnet.hudson.maven.plugins.hpi.MaskingClassLoader.loadClass(MaskingClassLoader.java:22)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:325)
... 21 more

and the KlocworkParser line 58 is : XPath xpa = XPath.newInstance("//klocwork:severity"); 

The jdom lib is in the target\klocwork-report\WEB-INF\lib folder but there is no folder "klocwork-report" in the work/plugins folder (when I am testing with hpi:run)

I really don't see where I'm wrong.. Thanks for your help.

--
Adrien Lecharpentier


2011/4/22 Kohsuke Kawaguchi <[hidden email]>

Yes, adding additional jars to a plugin is very well supported, and there are many many plugins that use that feature, so it's hard to imagine that it's down right broken.

To add to the list from Jesse,

 1. Please share the whole stack trace, not just the top of the line
 2. Please verify the contents of the hpi file and confirm that jdom
   jar is in WEB-INF/lib.


On 04/21/2011 06:03 PM, Jesse Farinacci wrote:
Greetings,

On Mon, Apr 18, 2011 at 8:02 AM, alecharp
<[hidden email]>  wrote:
 well, maybe I don't find what you meant but here is my pom
 declaration:
 <dependencies>
        <dependency>
                <groupId>org.jdom</groupId>
                <artifactId>jdom</artifactId>
                <version>1.1</version>
        </dependency>
 </dependencies>

 and I'm still having this error: java.lang.NoClassDefFoundError: org/
 jdom/Parent: org/jdom/Parent

Well, to solve this more information is required. You should post your
pom.xml and how are you invoking your plugin to trigger this issue?
What about the results of mvn dependency:analyze?

-Jesse



--
Kohsuke Kawaguchi | CloudBees, Inc. | http://cloudbees.com/

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Jenkins plugin and External libraries

alecharp
I found the solution: use a newer version of the parent.. 1.350->1.398 fixed the problem

thank you for your time.

--
Adrien Lecharpentier


2011/4/22 Adrien Lecharpentier <[hidden email]>
Hi,

so my pom.xml: 
<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.jvnet.hudson.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.350</version>
</parent>
<groupId>com.alcatel_lucent.prod.plugins.hudson</groupId>
<artifactId>klocwork-report</artifactId>
<name>Klocwork Report Plugin for Hudson</name>
<version>1.0.7-SNAPSHOT</version>
<packaging>hpi</packaging>
<description>
Enable to get information from a klocwork analys. 
Parsing a xml result file, generated by maven-klocwork-plugin and a 
klocwork command line. Also permit to add a direct link to the project 
root of the klocwork report onto the klocwork server.
</description>
<url />
<scm>
<connection>**</connection>
<developerConnection>**</developerConnection>
</scm>
<ciManagement>
<system>hudson</system>
<url>**</url>
</ciManagement>
<licenses>
<license>
<name>Alcatel-Lucent, 2010</name>
</license>
</licenses>

<dependencies>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0-beta-1</version>
</plugin>
</plugins>
</build>
<developers>
<developer>
<id>alecharp</id>
<name>Adrien Lecharpentier</name>
<email>[hidden email]</email>
</developer>
</developers>
<distributionManagement>
<repository>
<id>**</id>
<url>**</url>
</repository>
<snapshotRepository>
<id>**</id>
<url>**</url>
</snapshotRepository>
</distributionManagement>
</project>

to invoke this issue: 
SAXBuilder sxb = new SAXBuilder();
Document doc = sxb.build(input);
Element root = doc.getRootElement();
XPath xpa = XPath.newInstance("//klocwork:severity");
xpa.addNamespace("klocwork", XMLNS);

mvn dependency:analyse:
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.alcatel_lucent.prod.plugins.hudson:klocwork-report:hpi:1.0.7-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ org.jvnet.hudson:hudson:1.7, D:\Documents and Settings\alecharp\.m2\home-repo\org\jvnet\hudson\hudson\1.7\hudson-1.7.pom, line 81, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ org.jvnet.hudson.plugins:plugin:1.350, D:\Documents and Settings\alecharp\.m2\home-repo\org\jvnet\hudson\plugins\plugin\1.350\plugin-1.350.pom, line 179, column 15
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Klocwork Report Plugin for Hudson 1.0.7-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report >>>
[INFO] 
[INFO] --- maven-enforcer-plugin:1.0-beta-1:display-info (default) @ klocwork-report ---
[INFO] Maven Version: 3.0.3
[INFO] JDK Version: 1.6.0_24 normalized as: 1.6.0-24
[INFO] OS Info: Arch: x86 Family: windows Name: windows xp Version: 5.1
[INFO] 
[INFO] --- maven-localizer-plugin:1.8:generate (default) @ klocwork-report ---
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ klocwork-report ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 9 resources
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:apt-compile (default-apt-compile) @ klocwork-report ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:insert-test (default-insert-test) @ klocwork-report ---
[INFO] 
[INFO] --- gmaven-plugin:1.0-rc-5:generateTestStubs (test-in-groovy) @ klocwork-report ---
[INFO]  No sources found for Java stub generation
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ klocwork-report ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\myFactory\hudson\plugins_hudson\klocwork-report\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ klocwork-report ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:test-hpl (default-test-hpl) @ klocwork-report ---
[INFO] Generating D:\myFactory\hudson\plugins_hudson\klocwork-report\target\test-classes\the.hpl
[INFO] 
[INFO] --- gmaven-plugin:1.0-rc-5:testCompile (test-in-groovy) @ klocwork-report ---
[INFO]  No sources found to compile
[INFO] 
[INFO] <<< maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report <<<
[INFO] 
[INFO] --- maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report ---
[WARNING] Used undeclared dependencies found:
[WARNING]    org.kohsuke.stapler:json-lib:jar:2.1-rev6:provided
[WARNING]    jfree:jcommon:jar:1.0.12:provided
[WARNING]    jfree:jfreechart:jar:1.0.9:provided
[WARNING]    org.kohsuke.stapler:stapler:jar:1.137:provided
[WARNING] Unused declared dependencies found:
[WARNING]    org.jvnet.hudson.main:hudson-war:war:1.350:test
[WARNING]    javax.servlet:servlet-api:jar:2.4:provided
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.703s
[INFO] Finished at: Fri Apr 22 09:08:58 CEST 2011
[INFO] Final Memory: 10M/24M
[INFO] ------------------------------------------------------------------------

stacktrace:
org.jdom.JDOMException: java.lang.NoClassDefFoundError: org/jdom/Parent: org/jdom/Parent
at org.jdom.xpath.XPath.newInstance(XPath.java:146)
at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parse(KlocworkParser.java:58)
at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parser(KlocworkParser.java:35)
at com.alcatel_lucent.prod.plugins.hudson.KlocworkReportRecorder.perform(KlocworkReportRecorder.java:122)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:563)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:550)
at hudson.model.Build$RunnerImpl.post2(Build.java:152)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)
at hudson.model.Run.run(Run.java:1263)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:122)
Caused by: java.lang.NoClassDefFoundError: org/jdom/Parent
at org.jaxen.jdom.JDOMXPath.<init>(JDOMXPath.java:91)
at org.jdom.xpath.JaxenXPath.setXPath(JaxenXPath.java:281)
at org.jdom.xpath.JaxenXPath.<init>(JaxenXPath.java:99)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.jdom.xpath.XPath.newInstance(XPath.java:137)
... 13 more
Caused by: java.lang.ClassNotFoundException: org.jdom.Parent
at java.lang.ClassLoader.findClass(ClassLoader.java:359)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at org.jvnet.hudson.maven.plugins.hpi.MaskingClassLoader.loadClass(MaskingClassLoader.java:22)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:325)
... 21 more
Caused by: java.lang.NoClassDefFoundError: org/jdom/Parent
at org.jaxen.jdom.JDOMXPath.<init>(JDOMXPath.java:91)
at org.jdom.xpath.JaxenXPath.setXPath(JaxenXPath.java:281)
at org.jdom.xpath.JaxenXPath.<init>(JaxenXPath.java:99)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.jdom.xpath.XPath.newInstance(XPath.java:137)
at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parse(KlocworkParser.java:58)
at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parser(KlocworkParser.java:35)
at com.alcatel_lucent.prod.plugins.hudson.KlocworkReportRecorder.perform(KlocworkReportRecorder.java:122)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:563)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:550)
at hudson.model.Build$RunnerImpl.post2(Build.java:152)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)
at hudson.model.Run.run(Run.java:1263)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:122)
Caused by: java.lang.ClassNotFoundException: org.jdom.Parent
at java.lang.ClassLoader.findClass(ClassLoader.java:359)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at org.jvnet.hudson.maven.plugins.hpi.MaskingClassLoader.loadClass(MaskingClassLoader.java:22)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:325)
... 21 more

and the KlocworkParser line 58 is : XPath xpa = XPath.newInstance("//klocwork:severity"); 

The jdom lib is in the target\klocwork-report\WEB-INF\lib folder but there is no folder "klocwork-report" in the work/plugins folder (when I am testing with hpi:run)

I really don't see where I'm wrong.. Thanks for your help.

--
Adrien Lecharpentier



2011/4/22 Kohsuke Kawaguchi <[hidden email]>

Yes, adding additional jars to a plugin is very well supported, and there are many many plugins that use that feature, so it's hard to imagine that it's down right broken.

To add to the list from Jesse,

 1. Please share the whole stack trace, not just the top of the line
 2. Please verify the contents of the hpi file and confirm that jdom
   jar is in WEB-INF/lib.


On 04/21/2011 06:03 PM, Jesse Farinacci wrote:
Greetings,

On Mon, Apr 18, 2011 at 8:02 AM, alecharp
<[hidden email]>  wrote:
 well, maybe I don't find what you meant but here is my pom
 declaration:
 <dependencies>
        <dependency>
                <groupId>org.jdom</groupId>
                <artifactId>jdom</artifactId>
                <version>1.1</version>
        </dependency>
 </dependencies>

 and I'm still having this error: java.lang.NoClassDefFoundError: org/
 jdom/Parent: org/jdom/Parent

Well, to solve this more information is required. You should post your
pom.xml and how are you invoking your plugin to trigger this issue?
What about the results of mvn dependency:analyze?

-Jesse



--
Kohsuke Kawaguchi | CloudBees, Inc. | http://cloudbees.com/


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Jenkins plugin and External libraries

alecharp
In fact it doesn't solve my problem. I think the real problem comes from the version of the maven-hpi-plugin which is too old because when I try with org.jenkins-ci.tools:maven-hpi-plugin:1.61:run, there is no problem. But the problem is still here when I do a package.
I need my plugin to be runnable under jenkins and hudson, so which is the version of the hpi plugin I have to use? how to set it correctly so the package goal will produce a correct hpi?

thanks in advance.

--
Adrien Lecharpentier


2011/5/5 Adrien Lecharpentier <[hidden email]>
I found the solution: use a newer version of the parent.. 1.350->1.398 fixed the problem

thank you for your time.

--
Adrien Lecharpentier



2011/4/22 Adrien Lecharpentier <[hidden email]>
Hi,

so my pom.xml: 
<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.jvnet.hudson.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.350</version>
</parent>
<groupId>com.alcatel_lucent.prod.plugins.hudson</groupId>
<artifactId>klocwork-report</artifactId>
<name>Klocwork Report Plugin for Hudson</name>
<version>1.0.7-SNAPSHOT</version>
<packaging>hpi</packaging>
<description>
Enable to get information from a klocwork analys. 
Parsing a xml result file, generated by maven-klocwork-plugin and a 
klocwork command line. Also permit to add a direct link to the project 
root of the klocwork report onto the klocwork server.
</description>
<url />
<scm>
<connection>**</connection>
<developerConnection>**</developerConnection>
</scm>
<ciManagement>
<system>hudson</system>
<url>**</url>
</ciManagement>
<licenses>
<license>
<name>Alcatel-Lucent, 2010</name>
</license>
</licenses>

<dependencies>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0-beta-1</version>
</plugin>
</plugins>
</build>
<developers>
<developer>
<id>alecharp</id>
<name>Adrien Lecharpentier</name>
<email>[hidden email]</email>
</developer>
</developers>
<distributionManagement>
<repository>
<id>**</id>
<url>**</url>
</repository>
<snapshotRepository>
<id>**</id>
<url>**</url>
</snapshotRepository>
</distributionManagement>
</project>

to invoke this issue: 
SAXBuilder sxb = new SAXBuilder();
Document doc = sxb.build(input);
Element root = doc.getRootElement();
XPath xpa = XPath.newInstance("//klocwork:severity");
xpa.addNamespace("klocwork", XMLNS);

mvn dependency:analyse:
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.alcatel_lucent.prod.plugins.hudson:klocwork-report:hpi:1.0.7-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ org.jvnet.hudson:hudson:1.7, D:\Documents and Settings\alecharp\.m2\home-repo\org\jvnet\hudson\hudson\1.7\hudson-1.7.pom, line 81, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ org.jvnet.hudson.plugins:plugin:1.350, D:\Documents and Settings\alecharp\.m2\home-repo\org\jvnet\hudson\plugins\plugin\1.350\plugin-1.350.pom, line 179, column 15
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Klocwork Report Plugin for Hudson 1.0.7-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report >>>
[INFO] 
[INFO] --- maven-enforcer-plugin:1.0-beta-1:display-info (default) @ klocwork-report ---
[INFO] Maven Version: 3.0.3
[INFO] JDK Version: 1.6.0_24 normalized as: 1.6.0-24
[INFO] OS Info: Arch: x86 Family: windows Name: windows xp Version: 5.1
[INFO] 
[INFO] --- maven-localizer-plugin:1.8:generate (default) @ klocwork-report ---
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ klocwork-report ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 9 resources
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:apt-compile (default-apt-compile) @ klocwork-report ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:insert-test (default-insert-test) @ klocwork-report ---
[INFO] 
[INFO] --- gmaven-plugin:1.0-rc-5:generateTestStubs (test-in-groovy) @ klocwork-report ---
[INFO]  No sources found for Java stub generation
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ klocwork-report ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\myFactory\hudson\plugins_hudson\klocwork-report\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ klocwork-report ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:test-hpl (default-test-hpl) @ klocwork-report ---
[INFO] Generating D:\myFactory\hudson\plugins_hudson\klocwork-report\target\test-classes\the.hpl
[INFO] 
[INFO] --- gmaven-plugin:1.0-rc-5:testCompile (test-in-groovy) @ klocwork-report ---
[INFO]  No sources found to compile
[INFO] 
[INFO] <<< maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report <<<
[INFO] 
[INFO] --- maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report ---
[WARNING] Used undeclared dependencies found:
[WARNING]    org.kohsuke.stapler:json-lib:jar:2.1-rev6:provided
[WARNING]    jfree:jcommon:jar:1.0.12:provided
[WARNING]    jfree:jfreechart:jar:1.0.9:provided
[WARNING]    org.kohsuke.stapler:stapler:jar:1.137:provided
[WARNING] Unused declared dependencies found:
[WARNING]    org.jvnet.hudson.main:hudson-war:war:1.350:test
[WARNING]    javax.servlet:servlet-api:jar:2.4:provided
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.703s
[INFO] Finished at: Fri Apr 22 09:08:58 CEST 2011
[INFO] Final Memory: 10M/24M
[INFO] ------------------------------------------------------------------------

stacktrace:
org.jdom.JDOMException: java.lang.NoClassDefFoundError: org/jdom/Parent: org/jdom/Parent
at org.jdom.xpath.XPath.newInstance(XPath.java:146)
at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parse(KlocworkParser.java:58)
at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parser(KlocworkParser.java:35)
at com.alcatel_lucent.prod.plugins.hudson.KlocworkReportRecorder.perform(KlocworkReportRecorder.java:122)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:563)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:550)
at hudson.model.Build$RunnerImpl.post2(Build.java:152)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)
at hudson.model.Run.run(Run.java:1263)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:122)
Caused by: java.lang.NoClassDefFoundError: org/jdom/Parent
at org.jaxen.jdom.JDOMXPath.<init>(JDOMXPath.java:91)
at org.jdom.xpath.JaxenXPath.setXPath(JaxenXPath.java:281)
at org.jdom.xpath.JaxenXPath.<init>(JaxenXPath.java:99)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.jdom.xpath.XPath.newInstance(XPath.java:137)
... 13 more
Caused by: java.lang.ClassNotFoundException: org.jdom.Parent
at java.lang.ClassLoader.findClass(ClassLoader.java:359)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at org.jvnet.hudson.maven.plugins.hpi.MaskingClassLoader.loadClass(MaskingClassLoader.java:22)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:325)
... 21 more
Caused by: java.lang.NoClassDefFoundError: org/jdom/Parent
at org.jaxen.jdom.JDOMXPath.<init>(JDOMXPath.java:91)
at org.jdom.xpath.JaxenXPath.setXPath(JaxenXPath.java:281)
at org.jdom.xpath.JaxenXPath.<init>(JaxenXPath.java:99)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.jdom.xpath.XPath.newInstance(XPath.java:137)
at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parse(KlocworkParser.java:58)
at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parser(KlocworkParser.java:35)
at com.alcatel_lucent.prod.plugins.hudson.KlocworkReportRecorder.perform(KlocworkReportRecorder.java:122)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:563)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:550)
at hudson.model.Build$RunnerImpl.post2(Build.java:152)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)
at hudson.model.Run.run(Run.java:1263)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:122)
Caused by: java.lang.ClassNotFoundException: org.jdom.Parent
at java.lang.ClassLoader.findClass(ClassLoader.java:359)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at org.jvnet.hudson.maven.plugins.hpi.MaskingClassLoader.loadClass(MaskingClassLoader.java:22)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:325)
... 21 more

and the KlocworkParser line 58 is : XPath xpa = XPath.newInstance("//klocwork:severity"); 

The jdom lib is in the target\klocwork-report\WEB-INF\lib folder but there is no folder "klocwork-report" in the work/plugins folder (when I am testing with hpi:run)

I really don't see where I'm wrong.. Thanks for your help.

--
Adrien Lecharpentier



2011/4/22 Kohsuke Kawaguchi <[hidden email]>

Yes, adding additional jars to a plugin is very well supported, and there are many many plugins that use that feature, so it's hard to imagine that it's down right broken.

To add to the list from Jesse,

 1. Please share the whole stack trace, not just the top of the line
 2. Please verify the contents of the hpi file and confirm that jdom
   jar is in WEB-INF/lib.


On 04/21/2011 06:03 PM, Jesse Farinacci wrote:
Greetings,

On Mon, Apr 18, 2011 at 8:02 AM, alecharp
<[hidden email]>  wrote:
 well, maybe I don't find what you meant but here is my pom
 declaration:
 <dependencies>
        <dependency>
                <groupId>org.jdom</groupId>
                <artifactId>jdom</artifactId>
                <version>1.1</version>
        </dependency>
 </dependencies>

 and I'm still having this error: java.lang.NoClassDefFoundError: org/
 jdom/Parent: org/jdom/Parent

Well, to solve this more information is required. You should post your
pom.xml and how are you invoking your plugin to trigger this issue?
What about the results of mvn dependency:analyze?

-Jesse



--
Kohsuke Kawaguchi | CloudBees, Inc. | http://cloudbees.com/



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Jenkins plugin and External libraries

Ulli Hafner
I'm using the following configuration snippets:

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

  <dependencies>
    <dependency>
      <groupId>org.jvnet.hudson.main</groupId>
      <artifactId>maven-plugin</artifactId>
      <version>1.395</version>
    </dependency>
    <dependency>
      <groupId>org.jvnet.hudson.main</groupId>
      <artifactId>hudson-core</artifactId>
      <version>1.395</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.jenkins-ci.tools</groupId>
        <artifactId>maven-hpi-plugin</artifactId>
        <configuration>
          <disabledTestInjection>true</disabledTestInjection>
          <showDeprecation>true</showDeprecation>
          <showWarnings>true</showWarnings>
        </configuration>
      </plugin>
    </plugins>

Ulli

On 05/11/2011 11:43 AM, Adrien Lecharpentier wrote:
In fact it doesn't solve my problem. I think the real problem comes from the version of the maven-hpi-plugin which is too old because when I try with org.jenkins-ci.tools:maven-hpi-plugin:1.61:run, there is no problem. But the problem is still here when I do a package.
I need my plugin to be runnable under jenkins and hudson, so which is the version of the hpi plugin I have to use? how to set it correctly so the package goal will produce a correct hpi?

thanks in advance.

--
Adrien Lecharpentier


2011/5/5 Adrien Lecharpentier <[hidden email]>
I found the solution: use a newer version of the parent.. 1.350->1.398 fixed the problem

thank you for your time.

--
Adrien Lecharpentier



2011/4/22 Adrien Lecharpentier <[hidden email]>
Hi,

so my pom.xml: 
<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.jvnet.hudson.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.350</version>
</parent>
<groupId>com.alcatel_lucent.prod.plugins.hudson</groupId>
<artifactId>klocwork-report</artifactId>
<name>Klocwork Report Plugin for Hudson</name>
<version>1.0.7-SNAPSHOT</version>
<packaging>hpi</packaging>
<description>
Enable to get information from a klocwork analys. 
Parsing a xml result file, generated by maven-klocwork-plugin and a 
klocwork command line. Also permit to add a direct link to the project 
root of the klocwork report onto the klocwork server.
</description>
<url />
<scm>
<connection>**</connection>
<developerConnection>**</developerConnection>
</scm>
<ciManagement>
<system>hudson</system>
<url>**</url>
</ciManagement>
<licenses>
<license>
<name>Alcatel-Lucent, 2010</name>
</license>
</licenses>

<dependencies>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0-beta-1</version>
</plugin>
</plugins>
</build>
<developers>
<developer>
<id>alecharp</id>
<name>Adrien Lecharpentier</name>
<email>[hidden email]</email>
</developer>
</developers>
<distributionManagement>
<repository>
<id>**</id>
<url>**</url>
</repository>
<snapshotRepository>
<id>**</id>
<url>**</url>
</snapshotRepository>
</distributionManagement>
</project>

to invoke this issue: 
SAXBuilder sxb = new SAXBuilder();
Document doc = sxb.build(input);
Element root = doc.getRootElement();
XPath xpa = XPath.newInstance("//klocwork:severity");
xpa.addNamespace("klocwork", XMLNS);

mvn dependency:analyse:
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.alcatel_lucent.prod.plugins.hudson:klocwork-report:hpi:1.0.7-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ org.jvnet.hudson:hudson:1.7, D:\Documents and Settings\alecharp\.m2\home-repo\org\jvnet\hudson\hudson\1.7\hudson-1.7.pom, line 81, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ org.jvnet.hudson.plugins:plugin:1.350, D:\Documents and Settings\alecharp\.m2\home-repo\org\jvnet\hudson\plugins\plugin\1.350\plugin-1.350.pom, line 179, column 15
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Klocwork Report Plugin for Hudson 1.0.7-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report >>>
[INFO] 
[INFO] --- maven-enforcer-plugin:1.0-beta-1:display-info (default) @ klocwork-report ---
[INFO] Maven Version: 3.0.3
[INFO] JDK Version: 1.6.0_24 normalized as: 1.6.0-24
[INFO] OS Info: Arch: x86 Family: windows Name: windows xp Version: 5.1
[INFO] 
[INFO] --- maven-localizer-plugin:1.8:generate (default) @ klocwork-report ---
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ klocwork-report ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 9 resources
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:apt-compile (default-apt-compile) @ klocwork-report ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:insert-test (default-insert-test) @ klocwork-report ---
[INFO] 
[INFO] --- gmaven-plugin:1.0-rc-5:generateTestStubs (test-in-groovy) @ klocwork-report ---
[INFO]  No sources found for Java stub generation
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ klocwork-report ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\myFactory\hudson\plugins_hudson\klocwork-report\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ klocwork-report ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:test-hpl (default-test-hpl) @ klocwork-report ---
[INFO] Generating D:\myFactory\hudson\plugins_hudson\klocwork-report\target\test-classes\the.hpl
[INFO] 
[INFO] --- gmaven-plugin:1.0-rc-5:testCompile (test-in-groovy) @ klocwork-report ---
[INFO]  No sources found to compile
[INFO] 
[INFO] <<< maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report <<<
[INFO] 
[INFO] --- maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report ---
[WARNING] Used undeclared dependencies found:
[WARNING]    org.kohsuke.stapler:json-lib:jar:2.1-rev6:provided
[WARNING]    jfree:jcommon:jar:1.0.12:provided
[WARNING]    jfree:jfreechart:jar:1.0.9:provided
[WARNING]    org.kohsuke.stapler:stapler:jar:1.137:provided
[WARNING] Unused declared dependencies found:
[WARNING]    org.jvnet.hudson.main:hudson-war:war:1.350:test
[WARNING]    javax.servlet:servlet-api:jar:2.4:provided
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.703s
[INFO] Finished at: Fri Apr 22 09:08:58 CEST 2011
[INFO] Final Memory: 10M/24M
[INFO] ------------------------------------------------------------------------

stacktrace:
org.jdom.JDOMException: java.lang.NoClassDefFoundError: org/jdom/Parent: org/jdom/Parent



at org.jdom.xpath.XPath.newInstance(XPath.java:146)



at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parse(KlocworkParser.java:58)



at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parser(KlocworkParser.java:35)



at com.alcatel_lucent.prod.plugins.hudson.KlocworkReportRecorder.perform(KlocworkReportRecorder.java:122)



at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)



at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582)



at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:563)



at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:550)



at hudson.model.Build$RunnerImpl.post2(Build.java:152)



at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)



at hudson.model.Run.run(Run.java:1263)



at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)



at hudson.model.ResourceController.execute(ResourceController.java:88)



at hudson.model.Executor.run(Executor.java:122)



Caused by: java.lang.NoClassDefFoundError: org/jdom/Parent



at org.jaxen.jdom.JDOMXPath.<init>(JDOMXPath.java:91)



at org.jdom.xpath.JaxenXPath.setXPath(JaxenXPath.java:281)



at org.jdom.xpath.JaxenXPath.<init>(JaxenXPath.java:99)



at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)



at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)



at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)



at java.lang.reflect.Constructor.newInstance(Constructor.java:513)



at org.jdom.xpath.XPath.newInstance(XPath.java:137)



... 13 more



Caused by: java.lang.ClassNotFoundException: org.jdom.Parent



at java.lang.ClassLoader.findClass(ClassLoader.java:359)



at java.lang.ClassLoader.loadClass(ClassLoader.java:307)



at org.jvnet.hudson.maven.plugins.hpi.MaskingClassLoader.loadClass(MaskingClassLoader.java:22)



at java.lang.ClassLoader.loadClass(ClassLoader.java:248)



at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)



at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:325)



... 21 more



Caused by: java.lang.NoClassDefFoundError: org/jdom/Parent



at org.jaxen.jdom.JDOMXPath.<init>(JDOMXPath.java:91)



at org.jdom.xpath.JaxenXPath.setXPath(JaxenXPath.java:281)



at org.jdom.xpath.JaxenXPath.<init>(JaxenXPath.java:99)



at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)



at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)



at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)



at java.lang.reflect.Constructor.newInstance(Constructor.java:513)



at org.jdom.xpath.XPath.newInstance(XPath.java:137)



at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parse(KlocworkParser.java:58)



at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parser(KlocworkParser.java:35)



at com.alcatel_lucent.prod.plugins.hudson.KlocworkReportRecorder.perform(KlocworkReportRecorder.java:122)



at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)



at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582)



at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:563)



at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:550)



at hudson.model.Build$RunnerImpl.post2(Build.java:152)



at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)



at hudson.model.Run.run(Run.java:1263)



at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)



at hudson.model.ResourceController.execute(ResourceController.java:88)



at hudson.model.Executor.run(Executor.java:122)



Caused by: java.lang.ClassNotFoundException: org.jdom.Parent



at java.lang.ClassLoader.findClass(ClassLoader.java:359)



at java.lang.ClassLoader.loadClass(ClassLoader.java:307)



at org.jvnet.hudson.maven.plugins.hpi.MaskingClassLoader.loadClass(MaskingClassLoader.java:22)



at java.lang.ClassLoader.loadClass(ClassLoader.java:248)



at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)



at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:325)



... 21 more


and the KlocworkParser line 58 is : XPath xpa = XPath.newInstance("//klocwork:severity"); 

The jdom lib is in the target\klocwork-report\WEB-INF\lib folder but there is no folder "klocwork-report" in the work/plugins folder (when I am testing with hpi:run)

I really don't see where I'm wrong.. Thanks for your help.

--
Adrien Lecharpentier



2011/4/22 Kohsuke Kawaguchi <[hidden email]>

Yes, adding additional jars to a plugin is very well supported, and there are many many plugins that use that feature, so it's hard to imagine that it's down right broken.

To add to the list from Jesse,

 1. Please share the whole stack trace, not just the top of the line
 2. Please verify the contents of the hpi file and confirm that jdom
   jar is in WEB-INF/lib.


On 04/21/2011 06:03 PM, Jesse Farinacci wrote:
Greetings,

On Mon, Apr 18, 2011 at 8:02 AM, alecharp
<[hidden email]>  wrote:
 well, maybe I don't find what you meant but here is my pom
 declaration:
 <dependencies>
        <dependency>
                <groupId>org.jdom</groupId>
                <artifactId>jdom</artifactId>
                <version>1.1</version>
        </dependency>
 </dependencies>

 and I'm still having this error: java.lang.NoClassDefFoundError: org/
 jdom/Parent: org/jdom/Parent

Well, to solve this more information is required. You should post your
pom.xml and how are you invoking your plugin to trigger this issue?
What about the results of mvn dependency:analyze?

-Jesse



--
Kohsuke Kawaguchi | CloudBees, Inc. | http://cloudbees.com/




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Jenkins plugin and External libraries

alecharp
First, thank you for your reply.

But I have this error:
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Version of org.jenkins-ci.main:jenkins-war:war:1.399 is inconsistent with org.jvnet.hudson.main:maven-plugin:jar:1.395

Why it is so hard for me to have this working whereas kosuke said it's a basic feature? 
By default, the newer version of the maven-hpi-plugin that is used is 1.54. Maybe the problem comes from that?
--
Adrien Lecharpentier


2011/5/11 Ullrich Hafner <[hidden email]>
I'm using the following configuration snippets:

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

  <dependencies>
    <dependency>
      <groupId>org.jvnet.hudson.main</groupId>
      <artifactId>maven-plugin</artifactId>
      <version>1.395</version>
    </dependency>
    <dependency>
      <groupId>org.jvnet.hudson.main</groupId>
      <artifactId>hudson-core</artifactId>
      <version>1.395</version>
      <scope>provided</scope>

    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.jenkins-ci.tools</groupId>
        <artifactId>maven-hpi-plugin</artifactId>
        <configuration>
          <disabledTestInjection>true</disabledTestInjection>
          <showDeprecation>true</showDeprecation>
          <showWarnings>true</showWarnings>
        </configuration>
      </plugin>
    </plugins>

Ulli


On 05/11/2011 11:43 AM, Adrien Lecharpentier wrote:
In fact it doesn't solve my problem. I think the real problem comes from the version of the maven-hpi-plugin which is too old because when I try with org.jenkins-ci.tools:maven-hpi-plugin:1.61:run, there is no problem. But the problem is still here when I do a package.
I need my plugin to be runnable under jenkins and hudson, so which is the version of the hpi plugin I have to use? how to set it correctly so the package goal will produce a correct hpi?

thanks in advance.

--
Adrien Lecharpentier


2011/5/5 Adrien Lecharpentier <[hidden email]>
I found the solution: use a newer version of the parent.. 1.350->1.398 fixed the problem

thank you for your time.

--
Adrien Lecharpentier



2011/4/22 Adrien Lecharpentier <[hidden email]>
Hi,

so my pom.xml: 
<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.jvnet.hudson.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.350</version>
</parent>
<groupId>com.alcatel_lucent.prod.plugins.hudson</groupId>
<artifactId>klocwork-report</artifactId>
<name>Klocwork Report Plugin for Hudson</name>
<version>1.0.7-SNAPSHOT</version>
<packaging>hpi</packaging>
<description>
Enable to get information from a klocwork analys. 
Parsing a xml result file, generated by maven-klocwork-plugin and a 
klocwork command line. Also permit to add a direct link to the project 
root of the klocwork report onto the klocwork server.
</description>
<url />
<scm>
<connection>**</connection>
<developerConnection>**</developerConnection>
</scm>
<ciManagement>
<system>hudson</system>
<url>**</url>
</ciManagement>
<licenses>
<license>
<name>Alcatel-Lucent, 2010</name>
</license>
</licenses>

<dependencies>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0-beta-1</version>
</plugin>
</plugins>
</build>
<developers>
<developer>
<id>alecharp</id>
<name>Adrien Lecharpentier</name>
<email>[hidden email]</email>
</developer>
</developers>
<distributionManagement>
<repository>
<id>**</id>
<url>**</url>
</repository>
<snapshotRepository>
<id>**</id>
<url>**</url>
</snapshotRepository>
</distributionManagement>
</project>

to invoke this issue: 
SAXBuilder sxb = new SAXBuilder();
Document doc = sxb.build(input);
Element root = doc.getRootElement();
XPath xpa = XPath.newInstance("//klocwork:severity");
xpa.addNamespace("klocwork", XMLNS);

mvn dependency:analyse:
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.alcatel_lucent.prod.plugins.hudson:klocwork-report:hpi:1.0.7-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ org.jvnet.hudson:hudson:1.7, D:\Documents and Settings\alecharp\.m2\home-repo\org\jvnet\hudson\hudson\1.7\hudson-1.7.pom, line 81, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ org.jvnet.hudson.plugins:plugin:1.350, D:\Documents and Settings\alecharp\.m2\home-repo\org\jvnet\hudson\plugins\plugin\1.350\plugin-1.350.pom, line 179, column 15
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Klocwork Report Plugin for Hudson 1.0.7-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report >>>
[INFO] 
[INFO] --- maven-enforcer-plugin:1.0-beta-1:display-info (default) @ klocwork-report ---
[INFO] Maven Version: 3.0.3
[INFO] JDK Version: 1.6.0_24 normalized as: 1.6.0-24
[INFO] OS Info: Arch: x86 Family: windows Name: windows xp Version: 5.1
[INFO] 
[INFO] --- maven-localizer-plugin:1.8:generate (default) @ klocwork-report ---
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ klocwork-report ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 9 resources
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:apt-compile (default-apt-compile) @ klocwork-report ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:insert-test (default-insert-test) @ klocwork-report ---
[INFO] 
[INFO] --- gmaven-plugin:1.0-rc-5:generateTestStubs (test-in-groovy) @ klocwork-report ---
[INFO]  No sources found for Java stub generation
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ klocwork-report ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\myFactory\hudson\plugins_hudson\klocwork-report\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ klocwork-report ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:test-hpl (default-test-hpl) @ klocwork-report ---
[INFO] Generating D:\myFactory\hudson\plugins_hudson\klocwork-report\target\test-classes\the.hpl
[INFO] 
[INFO] --- gmaven-plugin:1.0-rc-5:testCompile (test-in-groovy) @ klocwork-report ---
[INFO]  No sources found to compile
[INFO] 
[INFO] <<< maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report <<<
[INFO] 
[INFO] --- maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report ---
[WARNING] Used undeclared dependencies found:
[WARNING]    org.kohsuke.stapler:json-lib:jar:2.1-rev6:provided
[WARNING]    jfree:jcommon:jar:1.0.12:provided
[WARNING]    jfree:jfreechart:jar:1.0.9:provided
[WARNING]    org.kohsuke.stapler:stapler:jar:1.137:provided
[WARNING] Unused declared dependencies found:
[WARNING]    org.jvnet.hudson.main:hudson-war:war:1.350:test
[WARNING]    javax.servlet:servlet-api:jar:2.4:provided
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.703s
[INFO] Finished at: Fri Apr 22 09:08:58 CEST 2011
[INFO] Final Memory: 10M/24M
[INFO] ------------------------------------------------------------------------

stacktrace:
org.jdom.JDOMException: java.lang.NoClassDefFoundError: org/jdom/Parent: org/jdom/Parent



at org.jdom.xpath.XPath.newInstance(XPath.java:146)



at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parse(KlocworkParser.java:58)



at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parser(KlocworkParser.java:35)



at com.alcatel_lucent.prod.plugins.hudson.KlocworkReportRecorder.perform(KlocworkReportRecorder.java:122)



at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)



at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582)



at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:563)



at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:550)



at hudson.model.Build$RunnerImpl.post2(Build.java:152)



at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)



at hudson.model.Run.run(Run.java:1263)



at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)



at hudson.model.ResourceController.execute(ResourceController.java:88)



at hudson.model.Executor.run(Executor.java:122)



Caused by: java.lang.NoClassDefFoundError: org/jdom/Parent



at org.jaxen.jdom.JDOMXPath.<init>(JDOMXPath.java:91)



at org.jdom.xpath.JaxenXPath.setXPath(JaxenXPath.java:281)



at org.jdom.xpath.JaxenXPath.<init>(JaxenXPath.java:99)



at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)



at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)



at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)



at java.lang.reflect.Constructor.newInstance(Constructor.java:513)



at org.jdom.xpath.XPath.newInstance(XPath.java:137)



... 13 more



Caused by: java.lang.ClassNotFoundException: org.jdom.Parent



at java.lang.ClassLoader.findClass(ClassLoader.java:359)



at java.lang.ClassLoader.loadClass(ClassLoader.java:307)



at org.jvnet.hudson.maven.plugins.hpi.MaskingClassLoader.loadClass(MaskingClassLoader.java:22)



at java.lang.ClassLoader.loadClass(ClassLoader.java:248)



at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)



at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:325)



... 21 more



Caused by: java.lang.NoClassDefFoundError: org/jdom/Parent



at org.jaxen.jdom.JDOMXPath.<init>(JDOMXPath.java:91)



at org.jdom.xpath.JaxenXPath.setXPath(JaxenXPath.java:281)



at org.jdom.xpath.JaxenXPath.<init>(JaxenXPath.java:99)



at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)



at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)



at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)



at java.lang.reflect.Constructor.newInstance(Constructor.java:513)



at org.jdom.xpath.XPath.newInstance(XPath.java:137)



at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parse(KlocworkParser.java:58)



at com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parser(KlocworkParser.java:35)



at com.alcatel_lucent.prod.plugins.hudson.KlocworkReportRecorder.perform(KlocworkReportRecorder.java:122)



at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)



at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582)



at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:563)



at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:550)



at hudson.model.Build$RunnerImpl.post2(Build.java:152)



at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)



at hudson.model.Run.run(Run.java:1263)



at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)



at hudson.model.ResourceController.execute(ResourceController.java:88)



at hudson.model.Executor.run(Executor.java:122)



Caused by: java.lang.ClassNotFoundException: org.jdom.Parent



at java.lang.ClassLoader.findClass(ClassLoader.java:359)



at java.lang.ClassLoader.loadClass(ClassLoader.java:307)



at org.jvnet.hudson.maven.plugins.hpi.MaskingClassLoader.loadClass(MaskingClassLoader.java:22)



at java.lang.ClassLoader.loadClass(ClassLoader.java:248)



at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)



at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:325)



... 21 more


and the KlocworkParser line 58 is : XPath xpa = XPath.newInstance("//klocwork:severity"); 

The jdom lib is in the target\klocwork-report\WEB-INF\lib folder but there is no folder "klocwork-report" in the work/plugins folder (when I am testing with hpi:run)

I really don't see where I'm wrong.. Thanks for your help.

--
Adrien Lecharpentier



2011/4/22 Kohsuke Kawaguchi <[hidden email]>

Yes, adding additional jars to a plugin is very well supported, and there are many many plugins that use that feature, so it's hard to imagine that it's down right broken.

To add to the list from Jesse,

 1. Please share the whole stack trace, not just the top of the line
 2. Please verify the contents of the hpi file and confirm that jdom
   jar is in WEB-INF/lib.


On 04/21/2011 06:03 PM, Jesse Farinacci wrote:
Greetings,

On Mon, Apr 18, 2011 at 8:02 AM, alecharp
<[hidden email]>  wrote:
 well, maybe I don't find what you meant but here is my pom
 declaration:
 <dependencies>
        <dependency>
                <groupId>org.jdom</groupId>
                <artifactId>jdom</artifactId>
                <version>1.1</version>
        </dependency>
 </dependencies>

 and I'm still having this error: java.lang.NoClassDefFoundError: org/
 jdom/Parent: org/jdom/Parent

Well, to solve this more information is required. You should post your
pom.xml and how are you invoking your plugin to trigger this issue?
What about the results of mvn dependency:analyze?

-Jesse



--
Kohsuke Kawaguchi | CloudBees, Inc. | http://cloudbees.com/





Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Jenkins plugin and External libraries

Ulli Hafner
I get this error only when using mvn hpi:run. mvn package (as well as mvn release) works perfectly with this setup for me...

Which mvn goal did you use?

Ulli


On 05/11/2011 04:46 PM, Adrien Lecharpentier wrote:
First, thank you for your reply.

But I have this error:
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Version of org.jenkins-ci.main:jenkins-war:war:1.399 is inconsistent with org.jvnet.hudson.main:maven-plugin:jar:1.395

Why it is so hard for me to have this working whereas kosuke said it's a basic feature? 
By default, the newer version of the maven-hpi-plugin that is used is 1.54. Maybe the problem comes from that?
--
Adrien Lecharpentier


2011/5/11 Ullrich Hafner <[hidden email]>
I'm using the following configuration snippets:

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

  <dependencies>
    <dependency>
      <groupId>org.jvnet.hudson.main</groupId>
      <artifactId>maven-plugin</artifactId>
      <version>1.395</version>
    </dependency>
    <dependency>
      <groupId>org.jvnet.hudson.main</groupId>
      <artifactId>hudson-core</artifactId>
      <version>1.395</version>
      <scope>provided</scope>

    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.jenkins-ci.tools</groupId>
        <artifactId>maven-hpi-plugin</artifactId>
        <configuration>
          <disabledTestInjection>true</disabledTestInjection>
          <showDeprecation>true</showDeprecation>
          <showWarnings>true</showWarnings>
        </configuration>
      </plugin>
    </plugins>

Ulli


On 05/11/2011 11:43 AM, Adrien Lecharpentier wrote:
In fact it doesn't solve my problem. I think the real problem comes from the version of the maven-hpi-plugin which is too old because when I try with org.jenkins-ci.tools:maven-hpi-plugin:1.61:run, there is no problem. But the problem is still here when I do a package.
I need my plugin to be runnable under jenkins and hudson, so which is the version of the hpi plugin I have to use? how to set it correctly so the package goal will produce a correct hpi?

thanks in advance.

--
Adrien Lecharpentier


2011/5/5 Adrien Lecharpentier <[hidden email]>
I found the solution: use a newer version of the parent.. 1.350->1.398 fixed the problem

thank you for your time.

--
Adrien Lecharpentier



2011/4/22 Adrien Lecharpentier <[hidden email]>
Hi,

so my pom.xml: 
<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.jvnet.hudson.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.350</version>
</parent>
<groupId>com.alcatel_lucent.prod.plugins.hudson</groupId>
<artifactId>klocwork-report</artifactId>
<name>Klocwork Report Plugin for Hudson</name>
<version>1.0.7-SNAPSHOT</version>
<packaging>hpi</packaging>
<description>
Enable to get information from a klocwork analys. 
Parsing a xml result file, generated by maven-klocwork-plugin and a 
klocwork command line. Also permit to add a direct link to the project 
root of the klocwork report onto the klocwork server.
</description>
<url />
<scm>
<connection>**</connection>
<developerConnection>**</developerConnection>
</scm>
<ciManagement>
<system>hudson</system>
<url>**</url>
</ciManagement>
<licenses>
<license>
<name>Alcatel-Lucent, 2010</name>
</license>
</licenses>

<dependencies>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0-beta-1</version>
</plugin>
</plugins>
</build>
<developers>
<developer>
<id>alecharp</id>
<name>Adrien Lecharpentier</name>
<email>[hidden email]</email>
</developer>
</developers>
<distributionManagement>
<repository>
<id>**</id>
<url>**</url>
</repository>
<snapshotRepository>
<id>**</id>
<url>**</url>
</snapshotRepository>
</distributionManagement>
</project>

to invoke this issue: 
SAXBuilder sxb = new SAXBuilder();
Document doc = sxb.build(input);
Element root = doc.getRootElement();
XPath xpa = XPath.newInstance("//klocwork:severity");
xpa.addNamespace("klocwork", XMLNS);

mvn dependency:analyse:
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.alcatel_lucent.prod.plugins.hudson:klocwork-report:hpi:1.0.7-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ org.jvnet.hudson:hudson:1.7, D:\Documents and Settings\alecharp\.m2\home-repo\org\jvnet\hudson\hudson\1.7\hudson-1.7.pom, line 81, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ org.jvnet.hudson.plugins:plugin:1.350, D:\Documents and Settings\alecharp\.m2\home-repo\org\jvnet\hudson\plugins\plugin\1.350\plugin-1.350.pom, line 179, column 15
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Klocwork Report Plugin for Hudson 1.0.7-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report >>>
[INFO] 
[INFO] --- maven-enforcer-plugin:1.0-beta-1:display-info (default) @ klocwork-report ---
[INFO] Maven Version: 3.0.3
[INFO] JDK Version: 1.6.0_24 normalized as: 1.6.0-24
[INFO] OS Info: Arch: x86 Family: windows Name: windows xp Version: 5.1
[INFO] 
[INFO] --- maven-localizer-plugin:1.8:generate (default) @ klocwork-report ---
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ klocwork-report ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 9 resources
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:apt-compile (default-apt-compile) @ klocwork-report ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:insert-test (default-insert-test) @ klocwork-report ---
[INFO] 
[INFO] --- gmaven-plugin:1.0-rc-5:generateTestStubs (test-in-groovy) @ klocwork-report ---
[INFO]  No sources found for Java stub generation
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ klocwork-report ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\myFactory\hudson\plugins_hudson\klocwork-report\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ klocwork-report ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:test-hpl (default-test-hpl) @ klocwork-report ---
[INFO] Generating D:\myFactory\hudson\plugins_hudson\klocwork-report\target\test-classes\the.hpl
[INFO] 
[INFO] --- gmaven-plugin:1.0-rc-5:testCompile (test-in-groovy) @ klocwork-report ---
[INFO]  No sources found to compile
[INFO] 
[INFO] <<< maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report <<<
[INFO] 
[INFO] --- maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report ---
[WARNING] Used undeclared dependencies found:
[WARNING]    org.kohsuke.stapler:json-lib:jar:2.1-rev6:provided
[WARNING]    jfree:jcommon:jar:1.0.12:provided
[WARNING]    jfree:jfreechart:jar:1.0.9:provided
[WARNING]    org.kohsuke.stapler:stapler:jar:1.137:provided
[WARNING] Unused declared dependencies found:
[WARNING]    org.jvnet.hudson.main:hudson-war:war:1.350:test
[WARNING]    javax.servlet:servlet-api:jar:2.4:provided
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.703s
[INFO] Finished at: Fri Apr 22 09:08:58 CEST 2011
[INFO] Final Memory: 10M/24M
[INFO] ------------------------------------------------------------------------

stacktrace:
org.jdom.JDOMException:
java.lang.NoClassDefFoundError:
org/jdom/Parent: org/jdom/Parent








at
org.jdom.xpath.XPath.newInstance(XPath.java:146)








at
com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parse(KlocworkParser.java:58)








at
com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parser(KlocworkParser.java:35)








at
com.alcatel_lucent.prod.plugins.hudson.KlocworkReportRecorder.perform(KlocworkReportRecorder.java:122)








at
hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)








at
hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582)








at
hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:563)








at
hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:550)








at
hudson.model.Build$RunnerImpl.post2(Build.java:152)








at
hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)








at
hudson.model.Run.run(Run.java:1263)








at
hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)








at
hudson.model.ResourceController.execute(ResourceController.java:88)








at
hudson.model.Executor.run(Executor.java:122)








Caused by:
java.lang.NoClassDefFoundError:
org/jdom/Parent








at
org.jaxen.jdom.JDOMXPath.<init>(JDOMXPath.java:91)








at
org.jdom.xpath.JaxenXPath.setXPath(JaxenXPath.java:281)








at
org.jdom.xpath.JaxenXPath.<init>(JaxenXPath.java:99)








at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)








at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)








at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)








at
java.lang.reflect.Constructor.newInstance(Constructor.java:513)








at
org.jdom.xpath.XPath.newInstance(XPath.java:137)








... 13 more








Caused by:
java.lang.ClassNotFoundException:
org.jdom.Parent








at
java.lang.ClassLoader.findClass(ClassLoader.java:359)








at
java.lang.ClassLoader.loadClass(ClassLoader.java:307)








at
org.jvnet.hudson.maven.plugins.hpi.MaskingClassLoader.loadClass(MaskingClassLoader.java:22)








at
java.lang.ClassLoader.loadClass(ClassLoader.java:248)








at
org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)








at
org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:325)








... 21 more








Caused by:
java.lang.NoClassDefFoundError:
org/jdom/Parent








at
org.jaxen.jdom.JDOMXPath.<init>(JDOMXPath.java:91)








at
org.jdom.xpath.JaxenXPath.setXPath(JaxenXPath.java:281)








at
org.jdom.xpath.JaxenXPath.<init>(JaxenXPath.java:99)








at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)








at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)








at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)








at
java.lang.reflect.Constructor.newInstance(Constructor.java:513)








at
org.jdom.xpath.XPath.newInstance(XPath.java:137)








at
com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parse(KlocworkParser.java:58)








at
com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parser(KlocworkParser.java:35)








at
com.alcatel_lucent.prod.plugins.hudson.KlocworkReportRecorder.perform(KlocworkReportRecorder.java:122)








at
hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)








at
hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582)








at
hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:563)








at
hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:550)








at
hudson.model.Build$RunnerImpl.post2(Build.java:152)








at
hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)








at
hudson.model.Run.run(Run.java:1263)








at
hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)








at
hudson.model.ResourceController.execute(ResourceController.java:88)








at
hudson.model.Executor.run(Executor.java:122)








Caused by:
java.lang.ClassNotFoundException:
org.jdom.Parent








at
java.lang.ClassLoader.findClass(ClassLoader.java:359)








at
java.lang.ClassLoader.loadClass(ClassLoader.java:307)








at
org.jvnet.hudson.maven.plugins.hpi.MaskingClassLoader.loadClass(MaskingClassLoader.java:22)








at
java.lang.ClassLoader.loadClass(ClassLoader.java:248)








at
org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)








at
org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:325)








... 21 more




and the KlocworkParser line 58 is : XPath xpa = XPath.newInstance("//klocwork:severity"); 

The jdom lib is in the target\klocwork-report\WEB-INF\lib folder but there is no folder "klocwork-report" in the work/plugins folder (when I am testing with hpi:run)

I really don't see where I'm wrong.. Thanks for your help.

--
Adrien Lecharpentier



2011/4/22 Kohsuke Kawaguchi <[hidden email]>

Yes, adding additional jars to a plugin is very well supported, and there are many many plugins that use that feature, so it's hard to imagine that it's down right broken.

To add to the list from Jesse,

 1. Please share the whole stack trace, not just the top of the line
 2. Please verify the contents of the hpi file and confirm that jdom
   jar is in WEB-INF/lib.


On 04/21/2011 06:03 PM, Jesse Farinacci wrote:
Greetings,

On Mon, Apr 18, 2011 at 8:02 AM, alecharp
<[hidden email]>  wrote:
 well, maybe I don't find what you meant but here is my pom
 declaration:
 <dependencies>
        <dependency>
                <groupId>org.jdom</groupId>
                <artifactId>jdom</artifactId>
                <version>1.1</version>
        </dependency>
 </dependencies>

 and I'm still having this error: java.lang.NoClassDefFoundError: org/
 jdom/Parent: org/jdom/Parent

Well, to solve this more information is required. You should post your
pom.xml and how are you invoking your plugin to trigger this issue?
What about the results of mvn dependency:analyze?

-Jesse



--
Kohsuke Kawaguchi | CloudBees, Inc. | http://cloudbees.com/






Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Jenkins plugin and External libraries

alecharp
I used hpi:run to test it. With mvn package it has no effect, still the noClassDefFoundError whereas the jdom lib is in the plugins\plugin_name\WEB-INF\lib folder.

--
Adrien Lecharpentier


2011/5/11 Ullrich Hafner <[hidden email]>
I get this error only when using mvn hpi:run. mvn package (as well as mvn release) works perfectly with this setup for me...

Which mvn goal did you use?

Ulli


On 05/11/2011 04:46 PM, Adrien Lecharpentier wrote:
First, thank you for your reply.

But I have this error:
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Version of org.jenkins-ci.main:jenkins-war:war:1.399 is inconsistent with org.jvnet.hudson.main:maven-plugin:jar:1.395

Why it is so hard for me to have this working whereas kosuke said it's a basic feature? 
By default, the newer version of the maven-hpi-plugin that is used is 1.54. Maybe the problem comes from that?
--
Adrien Lecharpentier


2011/5/11 Ullrich Hafner <[hidden email]>
I'm using the following configuration snippets:

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

  <dependencies>
    <dependency>
      <groupId>org.jvnet.hudson.main</groupId>
      <artifactId>maven-plugin</artifactId>
      <version>1.395</version>
    </dependency>
    <dependency>
      <groupId>org.jvnet.hudson.main</groupId>
      <artifactId>hudson-core</artifactId>
      <version>1.395</version>
      <scope>provided</scope>

    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.jenkins-ci.tools</groupId>
        <artifactId>maven-hpi-plugin</artifactId>
        <configuration>
          <disabledTestInjection>true</disabledTestInjection>
          <showDeprecation>true</showDeprecation>
          <showWarnings>true</showWarnings>
        </configuration>
      </plugin>
    </plugins>

Ulli


On 05/11/2011 11:43 AM, Adrien Lecharpentier wrote:
In fact it doesn't solve my problem. I think the real problem comes from the version of the maven-hpi-plugin which is too old because when I try with org.jenkins-ci.tools:maven-hpi-plugin:1.61:run, there is no problem. But the problem is still here when I do a package.
I need my plugin to be runnable under jenkins and hudson, so which is the version of the hpi plugin I have to use? how to set it correctly so the package goal will produce a correct hpi?

thanks in advance.

--
Adrien Lecharpentier


2011/5/5 Adrien Lecharpentier <[hidden email]>
I found the solution: use a newer version of the parent.. 1.350->1.398 fixed the problem

thank you for your time.

--
Adrien Lecharpentier



2011/4/22 Adrien Lecharpentier <[hidden email]>
Hi,

so my pom.xml: 
<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.jvnet.hudson.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.350</version>
</parent>
<groupId>com.alcatel_lucent.prod.plugins.hudson</groupId>
<artifactId>klocwork-report</artifactId>
<name>Klocwork Report Plugin for Hudson</name>
<version>1.0.7-SNAPSHOT</version>
<packaging>hpi</packaging>
<description>
Enable to get information from a klocwork analys. 
Parsing a xml result file, generated by maven-klocwork-plugin and a 
klocwork command line. Also permit to add a direct link to the project 
root of the klocwork report onto the klocwork server.
</description>
<url />
<scm>
<connection>**</connection>
<developerConnection>**</developerConnection>
</scm>
<ciManagement>
<system>hudson</system>
<url>**</url>
</ciManagement>
<licenses>
<license>
<name>Alcatel-Lucent, 2010</name>
</license>
</licenses>

<dependencies>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0-beta-1</version>
</plugin>
</plugins>
</build>
<developers>
<developer>
<id>alecharp</id>
<name>Adrien Lecharpentier</name>
<email>[hidden email]</email>
</developer>
</developers>
<distributionManagement>
<repository>
<id>**</id>
<url>**</url>
</repository>
<snapshotRepository>
<id>**</id>
<url>**</url>
</snapshotRepository>
</distributionManagement>
</project>

to invoke this issue: 
SAXBuilder sxb = new SAXBuilder();
Document doc = sxb.build(input);
Element root = doc.getRootElement();
XPath xpa = XPath.newInstance("//klocwork:severity");
xpa.addNamespace("klocwork", XMLNS);

mvn dependency:analyse:
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.alcatel_lucent.prod.plugins.hudson:klocwork-report:hpi:1.0.7-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ org.jvnet.hudson:hudson:1.7, D:\Documents and Settings\alecharp\.m2\home-repo\org\jvnet\hudson\hudson\1.7\hudson-1.7.pom, line 81, column 15
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ org.jvnet.hudson.plugins:plugin:1.350, D:\Documents and Settings\alecharp\.m2\home-repo\org\jvnet\hudson\plugins\plugin\1.350\plugin-1.350.pom, line 179, column 15
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Klocwork Report Plugin for Hudson 1.0.7-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report >>>
[INFO] 
[INFO] --- maven-enforcer-plugin:1.0-beta-1:display-info (default) @ klocwork-report ---
[INFO] Maven Version: 3.0.3
[INFO] JDK Version: 1.6.0_24 normalized as: 1.6.0-24
[INFO] OS Info: Arch: x86 Family: windows Name: windows xp Version: 5.1
[INFO] 
[INFO] --- maven-localizer-plugin:1.8:generate (default) @ klocwork-report ---
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ klocwork-report ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 9 resources
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:apt-compile (default-apt-compile) @ klocwork-report ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:insert-test (default-insert-test) @ klocwork-report ---
[INFO] 
[INFO] --- gmaven-plugin:1.0-rc-5:generateTestStubs (test-in-groovy) @ klocwork-report ---
[INFO]  No sources found for Java stub generation
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ klocwork-report ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\myFactory\hudson\plugins_hudson\klocwork-report\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ klocwork-report ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-hpi-plugin:1.48:test-hpl (default-test-hpl) @ klocwork-report ---
[INFO] Generating D:\myFactory\hudson\plugins_hudson\klocwork-report\target\test-classes\the.hpl
[INFO] 
[INFO] --- gmaven-plugin:1.0-rc-5:testCompile (test-in-groovy) @ klocwork-report ---
[INFO]  No sources found to compile
[INFO] 
[INFO] <<< maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report <<<
[INFO] 
[INFO] --- maven-dependency-plugin:2.1:analyze (default-cli) @ klocwork-report ---
[WARNING] Used undeclared dependencies found:
[WARNING]    org.kohsuke.stapler:json-lib:jar:2.1-rev6:provided
[WARNING]    jfree:jcommon:jar:1.0.12:provided
[WARNING]    jfree:jfreechart:jar:1.0.9:provided
[WARNING]    org.kohsuke.stapler:stapler:jar:1.137:provided
[WARNING] Unused declared dependencies found:
[WARNING]    org.jvnet.hudson.main:hudson-war:war:1.350:test
[WARNING]    javax.servlet:servlet-api:jar:2.4:provided
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.703s
[INFO] Finished at: Fri Apr 22 09:08:58 CEST 2011
[INFO] Final Memory: 10M/24M
[INFO] ------------------------------------------------------------------------

stacktrace:
org.jdom.JDOMException:
java.lang.NoClassDefFoundError:
org/jdom/Parent: org/jdom/Parent








at
org.jdom.xpath.XPath.newInstance(XPath.java:146)








at
com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parse(KlocworkParser.java:58)








at
com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parser(KlocworkParser.java:35)








at
com.alcatel_lucent.prod.plugins.hudson.KlocworkReportRecorder.perform(KlocworkReportRecorder.java:122)








at
hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)








at
hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582)








at
hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:563)








at
hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:550)








at
hudson.model.Build$RunnerImpl.post2(Build.java:152)








at
hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)








at
hudson.model.Run.run(Run.java:1263)








at
hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)








at
hudson.model.ResourceController.execute(ResourceController.java:88)








at
hudson.model.Executor.run(Executor.java:122)








Caused by:
java.lang.NoClassDefFoundError:
org/jdom/Parent








at
org.jaxen.jdom.JDOMXPath.<init>(JDOMXPath.java:91)








at
org.jdom.xpath.JaxenXPath.setXPath(JaxenXPath.java:281)








at
org.jdom.xpath.JaxenXPath.<init>(JaxenXPath.java:99)








at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)








at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)








at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)








at
java.lang.reflect.Constructor.newInstance(Constructor.java:513)








at
org.jdom.xpath.XPath.newInstance(XPath.java:137)








... 13 more








Caused by:
java.lang.ClassNotFoundException:
org.jdom.Parent








at
java.lang.ClassLoader.findClass(ClassLoader.java:359)








at
java.lang.ClassLoader.loadClass(ClassLoader.java:307)








at
org.jvnet.hudson.maven.plugins.hpi.MaskingClassLoader.loadClass(MaskingClassLoader.java:22)








at
java.lang.ClassLoader.loadClass(ClassLoader.java:248)








at
org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)








at
org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:325)








... 21 more








Caused by:
java.lang.NoClassDefFoundError:
org/jdom/Parent








at
org.jaxen.jdom.JDOMXPath.<init>(JDOMXPath.java:91)








at
org.jdom.xpath.JaxenXPath.setXPath(JaxenXPath.java:281)








at
org.jdom.xpath.JaxenXPath.<init>(JaxenXPath.java:99)








at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)








at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)








at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)








at
java.lang.reflect.Constructor.newInstance(Constructor.java:513)








at
org.jdom.xpath.XPath.newInstance(XPath.java:137)








at
com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parse(KlocworkParser.java:58)








at
com.alcatel_lucent.prod.plugins.hudson.data.KlocworkParser.parser(KlocworkParser.java:35)








at
com.alcatel_lucent.prod.plugins.hudson.KlocworkReportRecorder.perform(KlocworkReportRecorder.java:122)








at
hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)








at
hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582)








at
hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:563)








at
hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:550)








at
hudson.model.Build$RunnerImpl.post2(Build.java:152)








at
hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)








at
hudson.model.Run.run(Run.java:1263)








at
hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)








at
hudson.model.ResourceController.execute(ResourceController.java:88)








at
hudson.model.Executor.run(Executor.java:122)








Caused by:
java.lang.ClassNotFoundException:
org.jdom.Parent








at
java.lang.ClassLoader.findClass(ClassLoader.java:359)








at
java.lang.ClassLoader.loadClass(ClassLoader.java:307)








at
org.jvnet.hudson.maven.plugins.hpi.MaskingClassLoader.loadClass(MaskingClassLoader.java:22)








at
java.lang.ClassLoader.loadClass(ClassLoader.java:248)








at
org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)








at
org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:325)








... 21 more




and the KlocworkParser line 58 is : XPath xpa = XPath.newInstance("//klocwork:severity"); 

The jdom lib is in the target\klocwork-report\WEB-INF\lib folder but there is no folder "klocwork-report" in the work/plugins folder (when I am testing with hpi:run)

I really don't see where I'm wrong.. Thanks for your help.

--
Adrien Lecharpentier



2011/4/22 Kohsuke Kawaguchi <[hidden email]>

Yes, adding additional jars to a plugin is very well supported, and there are many many plugins that use that feature, so it's hard to imagine that it's down right broken.

To add to the list from Jesse,

 1. Please share the whole stack trace, not just the top of the line
 2. Please verify the contents of the hpi file and confirm that jdom
   jar is in WEB-INF/lib.


On 04/21/2011 06:03 PM, Jesse Farinacci wrote:
Greetings,

On Mon, Apr 18, 2011 at 8:02 AM, alecharp
<[hidden email]>  wrote:
 well, maybe I don't find what you meant but here is my pom
 declaration:
 <dependencies>
        <dependency>
                <groupId>org.jdom</groupId>
                <artifactId>jdom</artifactId>
                <version>1.1</version>
        </dependency>
 </dependencies>

 and I'm still having this error: java.lang.NoClassDefFoundError: org/
 jdom/Parent: org/jdom/Parent

Well, to solve this more information is required. You should post your
pom.xml and how are you invoking your plugin to trigger this issue?
What about the results of mvn dependency:analyze?

-Jesse



--
Kohsuke Kawaguchi | CloudBees, Inc. | http://cloudbees.com/







Loading...