1

I'm using CodeNarc maven plugin to static analyze tests written in groovy. I want to update libraries to higher version and unfortunately codeNarc maven plugin version is not working with groovy 2.5. Do you have any solution for that? Maybe another plugin?

Extract from pom.xml:

             <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>codenarc-maven-plugin</artifactId>
                <version>0.22-1</version>
                <configuration>
                    <groovyVersion>2.5.8</groovyVersion>
                    <rulesetfiles>file:///${project.basedir}/../config/codenarc.groovy</rulesetfiles>
                    <testSourceRoots>${project.basedir}/src/test/groovy</testSourceRoots>
                    <maxPriority1Violations>0</maxPriority1Violations>
                    <maxPriority2Violations>0</maxPriority2Violations>
                    <maxPriority3Violations>0</maxPriority3Violations>
                </configuration>
                <executions>
                    <execution>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>codenarc</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

during verify shows error:

[ERROR] Failure to find org.codehaus.groovy:groovy-all:jar:2.5.8 in https://maven.... was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced

I think it is connected with that:

                <dependency>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-all</artifactId>
                    <version>2.5.8</version>
                    <scope>runtime</scope>
                    <type>pom</type><!-- not jar!!! -->
                </dependency>
Piotr
  • 569
  • 6
  • 20

1 Answers1

0

I may be a bit late for this, but for others searching later on StackOverflow...

We used the CodeNarc Ant Task (we have all the versions in parent POMs):

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <dependencies>
          <dependency>
            <groupId>org.codenarc</groupId>
            <artifactId>CodeNarc</artifactId>
          </dependency>
          <dependency>
            <groupId>org.gmetrics</groupId>
            <artifactId>GMetrics</artifactId>
          </dependency>
          <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>codenarc-checks</id>
            <phase>process-classes</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <property name="compile_classpath"
                  refid="maven.compile.classpath" />
                <taskdef name="codenarc"
                  classname="org.codenarc.ant.CodeNarcTask" />
                <echo
                  message="Checking Groovy code with CodeNarc" />
                <codenarc
                  ruleSetFiles="file:/some/path/to/ruleset.groovy">
                  <report type="xml">
                    <option name="outputFile"
                      value="${project.build.directory}/codenarcReport.xml" />
                  </report>
                  <fileset dir="${groovy.main.directory}">
                    <include name="**/*.groovy" />
                  </fileset>
                </codenarc>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
eerriicc
  • 1,124
  • 4
  • 17
  • 29