You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Scott Maines <sm...@alaya.com> on 2009/02/26 04:19:13 UTC

Two issues: goals do not bind, JUnit annotations seem not to work

======= Two issues with Maven, perhaps pilot error

I have two issues at the moment,

* Goals do not seem to bind to phases as I expect
* Annotations in JUnit do not seem to be executing at all

The things which do not seem to work are so basic that I'm thinking the 
problems are local to me, and I
need additional insight. Please let me know what I am missing here.  I 
am using the Maven 2.0.9 distribution
under Fedora 9 with no settings file [since tried Maven 2.0.10 as well].

For those who would like to see the POM,  I've inlined it below the 
signature.


======= Issue 1: goals do not seem to bind to phases

I believe my pluginManagement section (see POM) should allow me to say,

$ mvn clean test

...and have aspects woven into the result.  As it turns out, AspectJ 
only works when I say,

$ mvn clean aspectj:compile aspectj:test-compile test

...and when it does so, it references in the output the ids of the 
executions I configured in the POM,

[INFO] [aspectj:compile]
[INFO] [aspectj:test-compile]
[INFO] [aspectj:compile {execution: aspectj-compile}]
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [aspectj:test-compile {execution: aspectj-test-compile}]

Also, I wonder whether, if the AspectJ goals were binding correctly to 
phases, I would see them here,

$ mvn help:describe -Dcmd=process-sources
...
[INFO] 'process-sources' is a phase corresponding to this plugin:

It is a part of the lifecycle for the POM packaging 'jar'. This 
lifecycle includes the following phases:
* validate: Not defined
* initialize: Not defined
* generate-sources: Not defined
* process-sources: Not defined
* generate-resources: Not defined
* process-resources: 
org.apache.maven.plugins:maven-resources-plugin:resources
* compile: org.apache.maven.plugins:maven-compiler-plugin:compile
* process-classes: Not defined
* generate-test-sources: Not defined
* process-test-sources: Not defined
* generate-test-resources: Not defined
* process-test-resources: 
org.apache.maven.plugins:maven-resources-plugin:testResources
* test-compile: org.apache.maven.plugins:maven-compiler-plugin:testCompile
* process-test-classes: Not defined
* test: org.apache.maven.plugins:maven-surefire-plugin:test
* package: org.apache.maven.plugins:maven-jar-plugin:jar
* pre-integration-test: Not defined
* integration-test: Not defined
* post-integration-test: Not defined
* verify: Not defined
* install: org.apache.maven.plugins:maven-install-plugin:install
* deploy: org.apache.maven.plugins:maven-deploy-plugin:deploy


======= Issue 2: annotations in JUnit do not seem to be executing at all

The tests all function as though the JUnit annotations I used, @Test and 
@Before, are not there, though the compiler
seems to process them, and complain if they are incorrectly included. 
The versions I configured I think should allow
for annotations. See POM below for version numbers.


Finally,...

This is my first post to this list, please pardon any inadvertent breach 
of process or etiquette.

Thanks in advance,

-SM

======= Inlined POM

<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>com.alaya.test</groupId>
  <artifactId>test-goal-bind</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>test-goal-bind</name>
 
     <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>1.6.2</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjtools</artifactId>
            <version>1.6.2</version>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                 <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-help-plugin</artifactId>
                    <configuration>
                        <detail>true</detail>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.4.3</version>
                </plugin>
               
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>${source-jdk}</source>
                        <target>${source-jdk}</target>
                        <debug>true</debug>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>aspectj-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>aspectj-compile</id>
                            <phase>process-sources</phase>
                            <goals>
                                <goal>compile</goal>                       
                            </goals>
                        </execution>
                        <execution>
                            <id>aspectj-test-compile</id>
                            <phase>process-test-sources</phase>        
               
                            <goals>
                                <goal>test-compile</goal>                
       
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <source>${source-jdk}</source>
                        <target>${source-jdk}</target>
                        <complianceLevel>${source-jdk}</complianceLevel>
                        <verbose>true</verbose>
                        <weaveMainSourceFolder>true</weaveMainSourceFolder>
                        <showWeaveInfo>true</showWeaveInfo>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <properties>
        <source-jdk>1.6</source-jdk>
     </properties>
</project>




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