tags:

views:

44

answers:

1

Hi,

I'm trying to use the animal sniffer Maven plugin to verify that code is compatible with JDK1.4. The following configuration works:

  <plugin>
    <groupId>org.jvnet</groupId>
    <artifactId>animal-sniffer</artifactId>
    <version>1.2</version>
    <configuration>
      <signature>
        <groupId>org.jvnet.animal-sniffer</groupId>
        <artifactId>java1.4</artifactId>
        <version>1.0</version>
      </signature>
    </configuration>
  </plugin>

However this is using the old org.jvnet version of the plugin. When I try to use the new org.codehaus.mojo version

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>animal-sniffer-maven-plugin</artifactId>
    <version>1.5</version>
    <configuration>
      <signature>
        <groupId>org.jvnet.animal-sniffer</groupId>
        <artifactId>java1.4</artifactId>
        <version>1.0</version>
      </signature>
    </configuration>
  </plugin>

I get the error

[INFO] Failed to resolve artifact.

GroupId: org.codehaus.mojo.animal-sniffer
ArtifactId: java1.4
Version: 1.0

Notice that this is the artifact referred to in the <signature> section, not the plugin itself. This same artifact is referenced in both versions, so I don't understand why it's not found when using the new version.

Has anyone successfully configured this plugin to work when using the new version?

Thanks, Don

+2  A: 

Use the signature from CodeHaus:

<build>
  <plugins>
    <plugin>
      <artifactId>maven-compiler-plugin</artifactId>
      <configuration>
        <source>1.4</source>
        <target>1.4</target>
      </configuration>
    </plugin>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>animal-sniffer-maven-plugin</artifactId>
      <version>1.5</version>
      <executions>
        <execution>
          <id>check-java-version</id>
          <phase>verify</phase>
          <goals>
            <goal>check</goal>
          </goals>
          <configuration>
            <signature>
              <groupId>org.codehaus.mojo.signature</groupId>
              <artifactId>java14</artifactId>
              <version>1.0</version>
            </signature>
          </configuration>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>
Pascal Thivent
Thanks a lot that seems to work. However, the plugin generates an insane amount of logging which adds about 1 minute to my build. Is there any way to suppress this?
Don
@Don I'm not aware of a way to do that. I suggest creating a Jira issue: http://jira.codehaus.org/browse/MANIMALSNIFFER
Pascal Thivent
@Pascal - I checked the JIRA and there's already a resolved issue for this problem. It hasn't been released yet though.
Don
@Don Nice, thanks for the feedback (is it [MANIMALSNIFFER-5](http://jira.codehaus.org/browse/MANIMALSNIFFER-5)? if yes, it's weird because it is marked as fixed in 1.5).
Pascal Thivent
No, it's http://jira.codehaus.org/browse/MANIMALSNIFFER-7, which is marked fixed in the unreleased 1.6 version
Don
@Don Ahhh, indeed (600Kb, ouch). Thanks.
Pascal Thivent