Announcement Announcement Module
Collapse
No announcement yet.
Problem with Maven Workspace Resolution Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with Maven Workspace Resolution

    Hello!

    I'm working on a project with Spring and Google Web Toolkit. I use Maven to manage dependencies.

    Now to my problem:
    I currently upgraded my STS to version 2.9.2 and hoped that, with the new m2eclipse-plugin version 1.0, the workspace resolution would work. Unfortunately I tried it for hours and hours, but I wasn't able to manage it. When I start the Spring-project (timerecording), the tc-Server always prints out a ClassNotFoundException of a Class which is in a related project on my workspace (timerecordingEntities). When I disable the workspace resolution it works perfectly.

    Code:
    java.lang.ClassNotFoundException: entities.Activity
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
            ...
    pom.xml of the spring-project (timerecording):
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    	<modelVersion>4.0.0</modelVersion>
    	<groupId>at.*****</groupId>
    	<artifactId>timerecording</artifactId>
    	<name>timerecordingAdminSpring</name>
    	<packaging>war</packaging>
    	<version>1.0.2-BUILD-SNAPSHOT</version>
    	<properties>
    		<java-version>1.6</java-version>
    		<org.springframework-version>3.0.6.RELEASE</org.springframework-version>
    		<org.aspectj-version>1.6.9</org.aspectj-version>
    		<org.slf4j-version>1.5.10</org.slf4j-version>
    	</properties>
    	<dependencies>
    		
    		<dependency>
    			<groupId>org.springframework.security</groupId>
    			<artifactId>spring-security-ldap</artifactId>
    			<version>3.0.6.RELEASE</version>
    		</dependency>
    		<dependency>
    			<groupId>at.***.spring</groupId>
    			<artifactId>myspring</artifactId>
    			<version>0.4-SNAPSHOT</version>
    		</dependency>
    		
    		<dependency>
    			<groupId>at.***.timerecording</groupId>
    			<artifactId>timerecordingEntities</artifactId>
    			<version>0.0.2-SNAPSHOT</version>
    		</dependency>
    		
    		<dependency>
    		    <groupId>org.hibernate</groupId>
    		    <artifactId>hibernate-validator-annotation-processor</artifactId>
    		    <version>4.1.0.Final</version>
    		</dependency>
    		
    		<dependency>
    			<groupId>at.****.timerecording</groupId>
    			<artifactId>timerecordingDAO</artifactId>
    			<version>0.0.3-SNAPSHOT</version>
    		</dependency>
    			<dependency>
    		    <groupId>net.sourceforge.jtds</groupId>
    		    <artifactId>jtds</artifactId>
    		    <version>1.2.4</version>
    		</dependency>
    		
    		<dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.8.2</version>
                <scope>test</scope>
            </dependency>
            
            <dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-test</artifactId>
    			<version>${org.springframework-version}</version>
    			<scope>test</scope>
    		</dependency>
    		
            <dependency>
    		    <groupId>org.quartz-scheduler</groupId>
    		    <artifactId>quartz</artifactId>
    		    <version>1.8.5</version>
    		</dependency>
    		
    		<dependency>
    		    <groupId>net.sf.jasperreports</groupId>
    		    <artifactId>jasperreports</artifactId>
    		    <version>4.5.1</version>
    		</dependency>
    		
    	    <dependency>
    		    <groupId>javax.servlet</groupId>
    		    <artifactId>servlet-api</artifactId>
    		    <version>2.5</version>
    		</dependency>
    
    		<dependency>
    		   <groupId>org.apache.openejb</groupId>
    		   <artifactId>commons-dbcp-all</artifactId>
    		   <version>1.3</version>
    		</dependency>
    
    		<dependency>
    		    <groupId>org.codehaus.groovy</groupId>
    		    <artifactId>groovy-all</artifactId>
    		    <version>1.8.6</version>
    		</dependency>
    		
    	</dependencies>
    	<build>
    		<plugins>
    			<plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-compiler-plugin</artifactId>
    				<configuration>
    					<source>${java-version}</source>
    					<target>${java-version}</target>
    				</configuration>
    			</plugin>
    			<plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-war-plugin</artifactId>
    				<configuration>
    					<warName>timerecording-1.0.1-BUILD-SNAPSHOT</warName>
    				</configuration>
    			</plugin>
    			<plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-dependency-plugin</artifactId>
    				<executions>
    					<execution>
    						<id>install</id>
    						<phase>install</phase>
    						<goals>
    							<goal>sources</goal>
    						</goals>
    					</execution>
    				</executions>
    			</plugin>
    			<plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-resources-plugin</artifactId>
    				<version>2.5</version>
    				<configuration>
    					<encoding>UTF-8</encoding>
    				</configuration>
    			</plugin>
    			
    			<plugin>
    			    <groupId>org.codehaus.mojo</groupId>
    			    <artifactId>tomcat-maven-plugin</artifactId>
    			    <version>1.1</version>
    			 
    			    <configuration>
    			        <path>/timerecording</path>
    			 
    			        <url>${dev_publish.tomcat.manager.uri}</url>
    			        <server>dev_publish</server>
    			    </configuration>
    			</plugin>
    		</plugins>
    	</build>
    </project>
    pom.xml of the related project (timerecordingEntities)
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <project
      xmlns="http://maven.apache.org/POM/4.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    
      <!-- POM file generated with GWT webAppCreator -->
      <modelVersion>4.0.0</modelVersion>
      <groupId>at.****.timerecording</groupId>
      <artifactId>timerecordingEntities</artifactId>
      <version>0.0.2-SNAPSHOT</version>
      <packaging>jar</packaging>
      <name>timerecordingEntities</name>
    
      <properties>
        <!-- Convenience property to set the GWT version -->
        <gwtVersion>2.4.0</gwtVersion>
        <!-- GWT needs at least java 1.5 -->
        <maven.compiler.source>1.6</maven.compiler.source>
    	<maven.compiler.target>1.6</maven.compiler.target>
        
        <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      </properties>
    
      <dependencies>
        <dependency>
          <groupId>com.google.gwt</groupId>
          <artifactId>gwt-servlet</artifactId>
          <version>${gwtVersion}</version>
          <scope>runtime</scope>
        </dependency>
        <dependency>
          <groupId>com.google.gwt</groupId>
          <artifactId>gwt-user</artifactId>
          <version>${gwtVersion}</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.7</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>javax.validation</groupId>
          <artifactId>validation-api</artifactId>
          <version>1.0.0.GA</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>javax.validation</groupId>
          <artifactId>validation-api</artifactId>
          <version>1.0.0.GA</version>
          <classifier>sources</classifier>
          <scope>test</scope>
        </dependency>
      </dependencies>
    
      <build>
        <!-- Generate compiled stuff in the folder used for developing mode -->
        <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
    
    	<resources>
    		<resource>
    			<directory>${basedir}/src/main/resources</directory>
    		</resource>
    		<resource>
    			<directory>${basedir}/src/main/java</directory>
    		</resource>
    	</resources>
    
        <plugins>
    
          <!-- GWT Maven Plugin -->
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <version>2.4.0</version>
            <executions>
              <execution>
                <goals>
                  <goal>compile</goal>
                  <goal>test</goal>
                  <goal>i18n</goal>
                  <goal>generateAsync</goal>
                </goals>
              </execution>
            </executions>
            <!-- Plugin configuration. There are many available options, see 
              gwt-maven-plugin documentation at codehaus.org -->
            <configuration>
              <runTarget>EntitiesModule.html</runTarget>
              <hostedWebapp>${webappDirectory}</hostedWebapp>
              <i18nMessagesBundle>at.***.timerecording.entities.client.Messages</i18nMessagesBundle>
            </configuration>
          </plugin>
    
          <!-- Copy static web files before executing gwt:run -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <executions>
              <execution>
                <phase>compile</phase>
                <goals>
                  <goal>exploded</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <webappDirectory>${webappDirectory}</webappDirectory>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
              <source>1.6</source>
              <target>1.6</target>
            </configuration>
          </plugin>
          
        </plugins>
      </build>
    
    </project>
    So is there any special (maven-)configuration required to get the workspace resolution work?

    Regards,
    Markus

  • #2
    There isn't anything specific that you need to add to your pom. All you should have to do is set up your launch configuration properly.

    In the Main tab of your maven launch configuration, make sure that "Resolve workspace artifacts" is checked.

    If this doesn't work for you, perhaps you'd get better feedback on the m2e-users mailing list. See here: https://dev.eclipse.org/mailman/listinfo/m2e-users

    Comment

    Working...
    X