Hi,

I use Jenkins with small Freestyle jobs for two years and am now looking into an
issue that requires me to get my feet wet with Java, Maven and Eclipse. By day
I'm working with ClearCase in a C++ shop.

I'd like to debug Jenkins with all the jobs and artifacts I have assembled.
I’m trying the goal jerkins-dev:run from eclipse as an intermediate step,
but I get "language errors“ as below. As a root cause it looks like
jenkins-core misses the dependency to org.kohsuke.stapler.lang.Klass.

Is this dependency declared properly?

How could maven even have found the outdated vesion of stapler-1.140.jar?


For starters, I follow 
https://wiki.jenkins-ci.org/display/JENKINS/Building+Jenkins
to get a debugable workspace. Git points to the stable-1.596 branch.

Output of maven --version:

        Apache Maven 3.3.1 (cab6659f9874fa96462afef40fcf6bc033d58c1c; 
2015-03-13T21:10:27+01:00)
        Maven home: /usr/local/Cellar/maven/3.3.1/libexec
        Java version: 1.8.0_40, vendor: Oracle Corporation
        Java home: 
/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/jre
        Default locale: de_DE, platform encoding: UTF-8
        OS name: "mac os x", version: "10.10.2", arch: "x86_64", family: "mac"

generate the workspace on jenkins main directory:

        mvn -DskipTests clean install package eclipse:eclipse

Then import eclipse projects. Generate a Maven launch config for jenkins-war
project, with the goal jenkins-dev:run, and -DskipTests.

Launch would fail with the error message:

Jenkins home directory: /Users/peter/git/jenkins/jenkins/war/work found at: 
System.getProperty("JENKINS_HOME")
[INFO] started 
o.m.j.p.JettyWebAppContext{/jenkins,file:/Users/peter/git/jenkins/jenkins/war/src/main/webapp/},file:/Users/peter/git/jenkins/jenkins/war/src/main/webapp/
[WARNING] FAILED authentication-filter: java.lang.Error: Unresolved compilation 
problem: 

java.lang.Error: Unresolved compilation problem: 

        at jenkins.model.Jenkins.getInstance(Jenkins.java:709)
        at hudson.security.HudsonFilter.init(HudsonFilter.java:104)
        at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:114)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
        at 
org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:755)
        at 
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:258)
        at 
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1234)
        at 
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:699)
        at 
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
        at 
org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:256)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
        at 
org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
        at 
org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:167)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
        at 
org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
        at 
org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90)
        at org.eclipse.jetty.server.Server.doStart(Server.java:262)
        at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
        at 
org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:511)
        at 
org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:364)
        at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:528)
        at 
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at 
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at 
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
[...]
[INFO] Jetty server exiting.


Actually, the eclipse project "jenkins-core" contains the following Error:

        Description:  The type org.kohsuke.stapler.lang.Klass cannot be 
resolved. It is indirectly referenced from required .class files
        Resource:     Descriptor.java
        Path:         /jenkins-core/src/main/java/hudson/model
        Location:     line 1
        Type:         Java Problem

The build path mentions this instance of org.kohsuke.stapler:
M2_REPO/org/kohsuke/stapler/stapler/1.140/stapler-1.140.jar
but that old jar has no class object for org.kohsuke.stapler.lang.Klass!!!


Adding this explicit dependency into core/pom.xml cures the problem:
Shouldn't it have been there from the start?
    <dependency>
      <groupId>org.kohsuke.stapler</groupId>
      <artifactId>stapler</artifactId>
      <version>${stapler.version}</version>
    </dependency>


Best Regards
Peter



-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/7BF6C7C8-47D8-4B29-A0C8-221FB11DE8B1%40web.de.
For more options, visit https://groups.google.com/d/optout.

Reply via email to