maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lewis, Eric" <Eric.Le...@ipi.ch>
Subject AW: AspectJ and Findbugs plugins not compatible?
Date Mon, 06 Jul 2009 09:21:25 GMT
Hi

Ok, I found the problem, and it's my fault  :-) 

Looks like it's a bad idea to let the plugin run only for the 'test-compile' goal, especially
with my special configuration. So I corrected it to run both on 'compile' and 'test-compile'.

Best regards,
Eric

---------------------------------

Hi

I'm having a strange problem which I don't understand.

First of all, I'm using AspectJ (with OVal) to check method parameters. This is at the moment
only done for test code.

Here is my POM:

<?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">
  <parent>
    <groupId>ch.ipi</groupId>
    <artifactId>util</artifactId>
    <version>1.0.0-SNAPSHOT</version>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <groupId>ch.ipi</groupId>
  <artifactId>util-validation</artifactId>
  <packaging>jar</packaging>
  <version>1.0.0-SNAPSHOT</version>
  <name>Validation Utilities</name>
  <description>Validates Java Beans and method parameters.</description>

  <scm>
    <url>${cvs.url.esv}/${parent.artifactId}/${project.artifactId}</url>
    <developerConnection>${cvs.connection.esv}/${parent.artifactId}/${project.artifactId}</developerConnection>
  </scm>
  
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>aspectj-maven-plugin</artifactId>
        <version>${aspectj-maven-plugin.version}</version>
        <configuration>
          <aspectDirectory>${java.test.default.directory}</aspectDirectory>
          <source>${source.version}</source>
          <target>${source.version}</target>
          <complianceLevel>${source.version}</complianceLevel>
          <encoding>${file.encoding}</encoding>
          <showWeaveInfo>true</showWeaveInfo>
          <verbose>true</verbose>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>test-compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>net.sf.oval</groupId>
      <artifactId>oval</artifactId>
    </dependency>
    <dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>aspectjrt</artifactId>
    </dependency>
    <dependency>
      <groupId>ch.ipi</groupId>
      <artifactId>util-reflection</artifactId>
    </dependency>
    <dependency>
      <groupId>ch.ipi</groupId>
      <artifactId>util-global</artifactId>
    </dependency>
    <dependency>
      <groupId>ch.ipi</groupId>
      <artifactId>util-time</artifactId>
    </dependency>
    <dependency>
      <groupId>ch.ipi</groupId>
      <artifactId>util-testing</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>commons-math</groupId>
      <artifactId>commons-math</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

</project>

(Note that dependency versions and scope are defined in the parent POM)


If I start the build with 'mvn clean package', everything works fine, including tests which
depend on AspectJ working.


However, if I do 'mvn clean package findbugs:findbugs', there are compile errors:

...
Tests run: 40, Failures: 0, Errors: 0, Skipped: 0

[INFO] [jar:jar]
...
[INFO] Preparing findbugs:findbugs
[INFO] [resources:resources]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] [compiler:compile]
[INFO] Compiling 25 source files to ...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure

.../util-validation/src/test/java/ch/ipi/esv/util/validation/text/CharacterCheckerTest.java:[6,16]
package org.junit does not exist

.../util-validation/src/test/java/ch/ipi/esv/util/validation/text/CharacterCheckerTest.java:[7,16]
package org.junit does not exist

etc. etc.


This is my Findbugs configuration:
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>findbugs-maven-plugin</artifactId>
          <configuration>
            <findbugsXmlOutput>true</findbugsXmlOutput>
            <findbugsXmlWithMessages>true</findbugsXmlWithMessages>
            <xmlOutput>true</xmlOutput>
            <effort>Max</effort>
            <excludeFilterFile>${build.home}findbugs/findbugs-exclude.xml</excludeFilterFile>
          </configuration>
        </plugin>


It seems to me that using the Findbugs plugin rebuilds the whole project. Is that right?
Anyway, I don't understand why it would build the tests, since by default <includeTests>
is 'false'.

Running the build with -X seems to confirm what I suspect:
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile' -->
...
[DEBUG]   (f) compileSourceRoots = [.../util-validation/src/main/java, .../util-validation/src/test/java]


Any hints?

Thanks & best regards,
Eric
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message