0

I have two maven projects I'm currently working on; project-data and project-base. project-data has a dependency on project-base defined in the pom as

<dependency>
        <groupId>com.tura.jetty</groupId>
        <artifactId>project-base</artifactId>
        <version>0.0.1-SNAPSHOT</version>
</dependency>

For java files everything is working fine, I can do imports and make references to classes in project-base in classes of project-data. The problem is, I also have to deal with dependencies on Groovy classes defined in project-base. When I try to reference a groovy class defined in project base from within a groovy class in project-data I get a 'Groovy:unable to resolve class' error. I tried moving my groovy classes into src/main/groovy but the error remained. Is there something more I need to be doing to make the groovy classes in project-base available to projects that depend on it?

For reference, here are some snippets from my pom.xml files. I'm using an archiva server for storing my custom libraries.

project-base

<project>
<groupId>com.tura.jetty</groupId>
  <artifactId>project-base</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <resources>
      <resource>
        <directory>src/main/java</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>       
            <compilerId>groovy-eclipse-compiler</compilerId>
            <source>1.7</source>
            <target>1.7</target>
        </configuration>       
        <dependencies>
        <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-eclipse-compiler</artifactId>
                <version>2.9.1-01</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-eclipse-batch</artifactId>
                <version>2.1.1-01</version>
            </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>2.1.1</version>
        <type>jar</type>
    </dependency>
  </dependencies>
</project>

project-data

<project>
<artifactId>project-data</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <build>
    <resources>
      <resource>
        <directory>src/main/java</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>src/test/java</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </testResource>
    </testResources>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>       
            <compilerId>groovy-eclipse-compiler</compilerId>
            <source>1.7</source>
            <target>1.7</target>
        </configuration>        
        <dependencies>
        <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-eclipse-compiler</artifactId>
                <version>2.9.1-01</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-eclipse-batch</artifactId>
                <version>2.1.1-01</version>
            </dependency>
        </dependencies>
      </plugin>
     </plugins> 
  </build>
  <dependencies>
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>2.1.1</version>
        <type>jar</type>
    </dependency>  
    <dependency>
        <groupId>com.tura.jetty</groupId>
        <artifactId>project-base</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>
</dependencies>
</project>
pbuchheit
  • 1,371
  • 1
  • 20
  • 47
  • What class? One from your own? Or one from Groovy? Also what is the deal with this ancient versions of groovy? – cfrick Aug 11 '21 at 16:15
  • @ cfrick One of my own classes. As for the groovy version, this is a legacy project so I'm stuck with it for the moment. – pbuchheit Aug 11 '21 at 17:16
  • And the error you see is not actually some transient missing class? I am not a maven user, so i can not tell if this is all the error message you get or are you leaving out the juicy parts? – cfrick Aug 11 '21 at 17:26
  • Is your missing class error coming from the IDE builder or from your maven build? If from the IDE, what do your projects look like once imported? – emilles Aug 11 '21 at 19:39

0 Answers0