I had the same problem, until I was helped to exclude some tests from being compiled, until on this list (5/12/05) Nik Gonzalez pointed out
the use of <testIncludes> and <testExcludes>.
The script below works fine for me.

Benedict

-----------------------------------
.......

        <plugin><!-- what to compile -->
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
           <configuration>
              <source>1.5</source>
              <target>1.5</target>
<includes>
                 <include>**/model/*.java</include>
              </includes>
<excludes>
                 <exclude>**/*Action.java</exclude>
              </excludes>
<testIncludes>
                 <testInclude>ou/erd/**/model/**/*Test.java</testInclude>
              </testIncludes>
<testExcludes>
                 <testExclude>**/*MutabilityTest.java</testExclude>
              </testExcludes>
</configuration>
        </plugin>

cameron101 wrote:

I too wish to exclude specific TestCase's but have tried the above
suggestion

....
<reporting>
       <plugins>
           <plugin>
               <groupId>org.codehaus.mojo</groupId>
               <artifactId>surefire-report-maven-plugin</artifactId>
               <configuration>
               <excludes>
               <exclude>**/*TransactionalTestCase.java</exclude>
               </excludes>
               </configuration>
           </plugin>
           <plugin>
               <groupId>org.codehaus.mojo</groupId>
               <artifactId>jxr-maven-plugin</artifactId>
           </plugin>
       </plugins>
   </reporting>

</project>
including updating the pluggins and the exclude does not appear to work !!
Any help greatly appreciated :-)




On 29/11/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Emmanuel

Thanks for helping me.

Stephen


Quoting [EMAIL PROTECTED]:

Hi

Ok, I have figured this out now.  The key fact is that I had my
configuration
for my plugin in my POM was defined inside an <executions> tag.

Basically for anyone else who needs to know this,

You can configure the default behaviour of plugins in your build by
adding a tag
for the plugin to the <build> section of your pom.

However you must NOT put the configuration section inside an
<Executions>
section or it will think that you are asking it to run the plugin again.

your plugin should look like this:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
 <excludes>
     <exclude>**/*Test.java</exclude>
 </excludes>
</configuration>
</plugin>


and NOT like this

<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-surefire-plugin</artifactId>
  <executions>
    <execution>
     <phase>test</phase>
     <configuration>
       <excludes>
         <exclude>**/*ABCTest.java</exclude>
       </excludes>
     </configuration>
     <goals>
        <goal>test</goal>
     </goals>
    </execution>
  </executions>
</plugin>


Quoting [EMAIL PROTECTED]:

Hi Emmanuel

Thanks, I have tried that now but it has made no difference.

Below is my trace and below that is my POM.  If you look at the
trace you will
see that the tests are getting run twice and the second time, the
exclusions
are being applied.

I do appreciate your help.

regards

Stephen


C:\workspaces\bdplus\bdp-core>mvn -U install
[INFO] Scanning for projects...
[INFO]

----------------------------------------------------------------------------
[INFO] Building Core
[INFO]    task-segment: [install]
[INFO]

----------------------------------------------------------------------------
[INFO] artifact org.apache.maven.plugins:maven-resources-plugin:
checking for
updates from snapshots
[INFO] artifact org.apache.maven.plugins:maven-resources-plugin:
checking for
updates from central
[INFO] artifact org.apache.maven.plugins:maven-compiler-plugin:checking for
updates from snapshots
[INFO] artifact org.apache.maven.plugins:maven-compiler-plugin:checking for
updates from central
[INFO] artifact org.apache.maven.plugins:maven-surefire-plugin:checking for
updates from snapshots
[WARNING] repository metadata for: 'artifact
org.apache.maven.plugins:maven-surefire-plugin' could not be retrieved
from
repository: snapshots due to an error: Error transferring file
[INFO] Repository 'snapshots' will be blacklisted
[INFO] artifact org.apache.maven.plugins:maven-surefire-plugin:checking for
updates from central
[INFO] artifact org.apache.maven.plugins:maven-jar-plugin: checking
for updates
from central
[INFO] artifact org.apache.maven.plugins:maven-install-plugin: checking
for
updates from central
[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] [bdp-buildcreateenv:create {execution: default}]
[INFO] Starting
[INFO] Creating 4 directories
[INFO] Directory
C:\workspaces\bdplus\bdp-core\target\TestData\Output already
exists.
[INFO] Directory
C:\workspaces\bdplus\bdp-core\target\TestData\Output\Bills\Standard
already
exists.
[INFO] Directory
C:\workspaces\bdplus\bdp-core\target\TestData\Output\Bills\Diverted
already
exists.
[INFO] Directory C:\workspaces\bdplus\bdp-core\target\TestData\temp
already
exists.
[INFO] Finished
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
Downloading:
http://repo1.maven.org/maven2/surefire/surefire/1.4/surefire-1.4.pom
663b downloaded
Downloading:

http://repo1.maven.org/maven2/surefire/surefire-root/1.1/surefire-root-1.1.pom
3K downloaded
Downloading:

http://repo1.maven.org/maven2/surefire/surefire-booter/1.4/surefire-booter-1.4.pom
539b downloaded
Downloading:

http://repo1.maven.org/maven2/surefire/surefire-booter/1.4/surefire-booter-1.4.jar
7K downloaded
Downloading:
http://repo1.maven.org/maven2/surefire/surefire/1.4/surefire-1.4.jar
58K downloaded
[INFO] [surefire:test]
[INFO] Setting reports dir:
C:\workspaces\bdplus\bdp-core\target/surefire-reports

-------------------------------------------------------
T E S T S
-------------------------------------------------------
[surefire] Running com.uk.cardinal.bdplus.core.generic.ConfigFileTest
[surefire] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0 sec
org.codehaus.surefire.IsolatedClassLoader
java.lang.LinkageError: Class org/w3c/dom/Document violates loader
constraints
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
      at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      at
org.codehaus.surefire.IsolatedClassLoader.loadClass(
IsolatedClassLoader.java:61)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
      at
com.uk.cardinal.bdplus.generic.Configuration.<init>(Configuration.java
:42)
      at
com.uk.cardinal.bdplus.core.processor.ProcessingEngine.init(
ProcessingEngine.java:70)
      at
com.uk.cardinal.bdplus.core.processor.ProcessingEngine.<init>(
ProcessingEngine.java:61)
      at
com.uk.cardinal.bdplus.core.processor.ProcessingEngineGeneva.<init>(
ProcessingEngineGeneva.java:60)
      at

com.uk.cardinal.bdplus.core.processor.invoke.BillDataPlusProcessor.process
(BillDataPlusProcessor.java:64)
      at

com.uk.cardinal.bdplus.core.processor.invoke.BillDataPlusProcessor.processFile
(BillDataPlusProcessor.java:40)
      at
com.uk.cardinal.bdplus.core.processor.ProcessorTest.testProcessor(
ProcessorTest.java:18)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at
sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
      at
sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at
sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
      at
sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at
org.codehaus.surefire.battery.JUnitBattery.executeJUnit(
JUnitBattery.java:246)
      at
org.codehaus.surefire.battery.JUnitBattery.execute(JUnitBattery.java
:220)
      at org.codehaus.surefire.Surefire.executeBattery(Surefire.java
:204)
      at org.codehaus.surefire.Surefire.run(Surefire.java:153)
      at org.codehaus.surefire.Surefire.run(Surefire.java:77)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at
sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
      at
sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.codehaus.surefire.SurefireBooter.run(SurefireBooter.java
:104)
      at
org.apache.maven.test.SurefirePlugin.execute(SurefirePlugin.java:303)
      at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(
DefaultPluginManager.java:399)
      at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
DefaultLifecycleExecutor.java:519)
      at

org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
(DefaultLifecycleExecutor.java:469)
      at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(
DefaultLifecycleExecutor.java:448)
      at

org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
(DefaultLifecycleExecutor.java:301)
      at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments
(DefaultLifecycleExecutor.java:268)
      at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
DefaultLifecycleExecutor.java:137)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java
:316)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:113)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at
sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
      at
sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[surefire] Running com.uk.cardinal.bdplus.core.processor.ProcessorTest
[surefire] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.953sec

Results :
[surefire] Tests run: 2, Failures: 0, Errors: 0

[INFO] [surefire:test {execution: default}]
[INFO] Setting reports dir:
C:\workspaces\bdplus\bdp-core\target/surefire-reports

-------------------------------------------------------
T E S T S
-------------------------------------------------------
There are no test to run.

Results :
[surefire] Tests run: 0, Failures: 0, Errors: 0

[INFO] [jar:jar]
[INFO] Building jar:
C:\workspaces\bdplus\bdp-core\target\bdp-core-1.0.0-dev.jar
[INFO] [install:install]
[INFO] Installing
C:\workspaces\bdplus\bdp-core\target\bdp-core-1.0.0-dev.jar to
C:\Documents and

Settings\scowx\.m2\repository\com\uk\cardinal\bdplus\bdp-core\1.0.0-dev\bdp-
core-1.0.0-dev.jar
[INFO]

----------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]

----------------------------------------------------------------------------
[INFO] Total time: 32 seconds
[INFO] Finished at: Tue Nov 29 15:24:39 GMT 2005
[INFO] Final Memory: 4M/8M
[INFO]

----------------------------------------------------------------------------
POM

<build>
 <plugins>
   <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-surefire-plugin</artifactId>
     <executions>
       <execution>
        <phase>test</phase>
        <configuration>
          <excludes>
            <exclude>**/*Test.java</exclude>
          </excludes>
        </configuration>
        <goals>
            <goal>test</goal>
          </goals>
      </execution>
      </executions>
    </plugin>
  </plugins>
</build>





Quoting Emmanuel Venisse <[EMAIL PROTECTED]>:

works fine for me, you perhaps have an old version of surefire plugin.
try to run mvn with -U to update your plugin

Emmanuel

[EMAIL PROTECTED] a �crit :
Hi Emmanuel

Thank you, but .. I have read that document and it doesn't answer
my question.

I HAVE configured my pom as per that document and the behaviour is
that it has
no effect on the default test plugin.  All that happens is that
the surefire
plugin gets executed twice.  Once for the default and once because
I have added
the above to my <build>. the one that has been added to my build
excludes the
classes but the default one doesn't.

Please explain how this works.

regards

Stephen

Quoting Emmanuel Venisse <[EMAIL PROTECTED]>:

http://maven.apache.org/plugins/maven-surefire-plugin/howto.html

Emmanuel

[EMAIL PROTECTED] a �crit :

Hi

This is a general question which applies to all plugins which
are part of the
default lifecycles, I am using the surefire plugin as an example:

I want to configure the surefire plugin that gets executed
during the test
phase? (I want to exclude cetain tests). How do I do this.

If I add a plugin to my plugins section e.g. :

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <executions>
     <execution>
     <phase>test</phase>
     <configuration>
    <excludes>
       <exclude>**/*ABCTest.java</exclude>
    </excludes>
     </configuration>
     <goals>
        <goal>test</goal>
     </goals>
    </execution>
  </executions>
</plugin>

it has no effect on the default test plugin.  All that happens
is that the
surefire plugin gets executed twice.  Once for the default and
once because I
have added the above to my <build>.

regards

Stephen







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]










---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.0.371 / Virus Database: 267.14.1/206 - Release Date: 16/12/2005


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to