15 Replies Last post: Feb 13, 2013 2:46 PM by Greg Gigon  
Greg Gigon Newbie 22 posts since
Jan 11, 2013
Currently Being Moderated

Jan 29, 2013 3:44 PM

Spring integration with IDEA 12 Ultimate and TeamCity plugin development issue

Hi Guys

I have a problem with Spring integration developing a TeamCity plugin.

 

I'm using IntelliJ 12 Ultimate (build 123.139) and developing TeamCity plugin. I'm using Spring librabry that comes packed with TeamCity 7.1.3. (the one in TeamCity\webapps\ROOT\WEB-INF\lib). The librabry spring.jar is set as my dependency (in Project Structure -> Modules -> Dependencies) along with spring-webmvc.jar. When I'm trying to build the project I get this error:

 

java: C:\Dev\Projects\blahblah\src\main\java\foo\bar\FooBarController.java:13: cannot access org.springframework.beans.factory.Aware

class file for org.springframework.beans.factory.Aware not found

 

The class org.springframework.beans.factory.Aware appears since Spring 3.x. The spring.jar that is bundled in TeamCity is old Spring 2.5.x and the only thing it has is BeanFactoryAware.

 

Something is not right and I cannot put a finger on it.

My FooBarController.java looks like this:

 

package foo.bar;

 

import jetbrains.buildServer.controllers.BaseController;

import jetbrains.buildServer.web.openapi.WebControllerManager;

import org.jetbrains.annotations.NotNull;

import org.jetbrains.annotations.Nullable;

import org.springframework.web.servlet.ModelAndView;

 

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import java.nio.charset.Charset;

 

public class FooBarController extends BaseController {

 

    public FooBarController (WebControllerManager webControllerManager) {

        logger.info("Registering new controller at URL");

        webControllerManager.registerController(SYNC_CONTROLLER, this);

    }

 

    @Nullable

    protected ModelAndView doHandle(@NotNull HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse) throws Exception {

        httpServletResponse.setStatus(HttpServletResponse.SC_OK);

        httpServletResponse.setContentType("text/plain");

        httpServletResponse.setCharacterEncoding("UTF-8");

        httpServletResponse.getOutputStream().write("OK".getBytes(Charset.forName("UTF-8")));

        return null;

    }

}

Any help would be appriciated.

 

Greg

Yann Cebron JetBrains 1,472 posts since
Aug 22, 2002
Currently Being Moderated
Jan 29, 2013 4:01 PM in response to: Greg Gigon
Re: Spring integration with IDEA 12 Ultimate and TeamCity plugin development issue

Could you zip and put online your project some place? This will be the easiest way to diagnose the cause. Thanks.

Yann Cebron JetBrains 1,472 posts since
Aug 22, 2002
Currently Being Moderated
Jan 29, 2013 5:12 PM in response to: Greg Gigon
Re: Spring integration with IDEA 12 Ultimate and TeamCity plugin development issue

I followed your steps but got stuck with some issues yet, so here's a couple of questions first:

 

- servlet-api.jar should not be in compile, but provided scope

- https://getsatisfaction.com/sonatype/topics/invalid_version_in_xmlschema_1_1_pom_xml XmlSchema 1.1 seems completely broken, for Atlassian stuff have to add Maven repo https://maven.atlassian.com/repository/public

- why do you generate "gradle idea" project files? did you try importing the build.gradle and let JetGradle plugin create/sync IDEA project from there?

 

Maybe other plugin authors shared their experience/setup with Gradle in TeamCity forum: http://devnet.jetbrains.com/community/teamcity ? Just a suggestion.

Yann Cebron JetBrains 1,472 posts since
Aug 22, 2002
Currently Being Moderated
Jan 29, 2013 6:27 PM in response to: Greg Gigon
Re: Spring integration with IDEA 12 Ultimate and TeamCity plugin development issue

Spring plugin will use whatever Spring library version is configured in your project, unless you tell it to download and create a new Spring library. Could you please double-check your Libraries in Project Structure and dependencies in your module for such duplicate Spring library?

Yann Cebron JetBrains 1,472 posts since
Aug 22, 2002
Currently Being Moderated
Jan 29, 2013 6:58 PM in response to: Greg Gigon
Re: Spring integration with IDEA 12 Ultimate and TeamCity plugin development issue

Ok, both config files look good indeed. Since I can't get your gradle build running here completely I can only second-guess, but is there a chance that from some other jar another Spring library is referenced or even re-packaged? IDEA will never attempt to use some default or create any such library unless told to do so, so it must be configured in your project somehow.

Yann Cebron JetBrains 1,472 posts since
Aug 22, 2002
Currently Being Moderated
Jan 29, 2013 7:55 PM in response to: Greg Gigon
Re: Spring integration with IDEA 12 Ultimate and TeamCity plugin development issue

This might be the underlying cause:

https://maven.atlassian.com/content/groups/public/com/atlassian/crowd/atlassian-crowd/2.5.3/atlassian-crowd-2.5.3.pom

 

From the POM it looks like Atlassian Crowd has a dependency to Spring Framework 3.1.2

Yann Cebron JetBrains 1,472 posts since
Aug 22, 2002
Currently Being Moderated
Jan 29, 2013 8:47 PM in response to: Greg Gigon
Re: Spring integration with IDEA 12 Ultimate and TeamCity plugin development issue

I'm not familiar with gradle:idea target, but I'd guess it does not include/show transitive dependencies. So I guess this issue is now resolved (at least from a what-caused-this perspective)?

Yann Cebron JetBrains 1,472 posts since
Aug 22, 2002
Currently Being Moderated
Jan 29, 2013 8:55 PM in response to: Greg Gigon
Re: Spring integration with IDEA 12 Ultimate and TeamCity plugin development issue

What I meant was the transitive dependency on Spring 3 comes from the fact that your code references crowd-classes which in turn need Spring 3.x in classpath to compile.The fact the gradle:idea does not resolve/include those dependencies is another issue.

At least that's what I think happens in your project (still can't get it up and running here).

Yann Cebron JetBrains 1,472 posts since
Aug 22, 2002
Currently Being Moderated
Feb 13, 2013 1:06 PM in response to: Yann Cebron
Re: Spring integration with IDEA 12 Ultimate and TeamCity plugin development issue

The error I got when trying to import your project (http://youtrack.jetbrains.com/issue/IDEA-100968) is fixed in 12.1. Please try upcoming EAP.

More Like This

  • Retrieving data ...