testExcludes: http://maven.apache.org/plugins/maven-compiler-plugin/testCompile-mojo.html#testExcludes "A list of exclusion filters for the compiler."
It must be a fairly easy task to tell maven to exclude a particular directory from compiling. I think there are 2 very simple use cases: 1. your build your project using maven, however the build fails because one of the unit tests fails: you may want to temporarily disable running the unit test without deleting the unit test. 2. your build fails because your unit test fails to compile: you may want to temporarily disable compiling the unit test. So using <testExcludes> <exclude>**/**</exclude> </testExcludes> but I cannot seem to filter for individual directories/classes. Joris On Tue, May 26, 2015 at 9:01 PM, Ron Wheeler <[email protected] > wrote: > Where did you read that this was possible? > Have you scanned some of the manuals and guides to see if you can find a > case like this? > > I am not sure that there is a use case for this. > > Ron > > > > > On 26/05/2015 8:55 PM, Joris Kinable wrote: > >> Thank you for the suggestion. Nevertheless, I would like to learn how to >> remove a particular directory of tests from the compile and run cycle: >> This successfully prevents *all* tests from being compiled: >> <plugin> >> <groupId>org.apache.maven.plugins</groupId> >> <artifactId>maven-compiler-plugin</artifactId> >> <version>3.3</version> >> <configuration> >> <source>1.8</source> >> <target>1.8</target> >> <testExcludes> >> <exclude>**/**</exclude> >> </testExcludes> >> </configuration> >> </plugin> >> >> However, I cannot seem to disable just jorlib-core/src/test/java/org/ >> jorlib/frameworks/columnGeneration/tsp e.g. adding: >> <testExcludes> >> <exclude>**/frameworks/**</exclude> >> <exclude>**/org/jorlib/frameworks/columnGeneration/tsp/*</exclude> >> </testExcludes> >> doesn't do anything. >> >> Joris >> >> On Tue, May 26, 2015 at 8:44 PM, Ron Wheeler < >> [email protected] >> >>> wrote: >>> It sounds like they belong in a separate project that includes the Cplex >>> test sources, possibly with your test sources with a pom to compile and >>> run >>> tests with Cplex and a README about how to compile and test them in >>> conjunction with your code. This should be used to produce a ZIP or TAR >>> (or >>> both). >>> The pom would include dependencies on your libraries. >>> >>> Since you are not going to test them, there is not much point in having >>> them in with your tests. >>> >>> The maven rule (best practice) of one pom for one output artifact, often >>> leads to simple solutions for these types of problems. >>> >>> You might want to consider packaging your final deliverable using an >>> installer that does the right thing when the sys admin wants to install >>> with or without the Cplex option. >>> This would take all of your artifacts and produce an installer. I use >>> IzPack which is an open source product but other installers could >>> probably >>> do this in a simple way. >>> >>> Ron >>> >>> On 26/05/2015 8:22 PM, Joris Kinable wrote: >>> >>> The files under >>>> jorlib-core/src/test/java/org/jorlib/frameworks/columnGeneration/tsp >>>> are a useful set of test classes, but unfortunately they rely on >>>> a proprietary, expensive package called Cplex, whereas all the other >>>> test >>>> classes are either self-contained or rely on open-source packages. I >>>> want >>>> the sources of >>>> jorlib-core/src/test/java/org/jorlib/frameworks/columnGeneration/tsp >>>> to be preserved, but I don't want to compile or run them. Anyone who >>>> downloads the release still has access to these sources so if he/she >>>> owns >>>> the Cplex package, he/she can manually perform these tests. However, if >>>> you >>>> don't own this package, then you can still compile the code without >>>> running >>>> into dependency issues. >>>> Nevertheless, when I run: mvn compile, everything works great. However, >>>> when I run mvn test or mvn package, maven tries to compile >>>> jorlib-core/src/ >>>> *test*/java/org/jorlib/frameworks/columnGeneration/tsp, even though I >>>> added >>>> >>>> (and many various thereof): >>>> >>>> <excludes> >>>> <exclude>columnGeneration/tsp/**</exclude> >>>> </excludes> >>>> >>>> to: >>>> >>>> <plugin> >>>> <groupId>org.apache.maven.plugins</groupId> >>>> <artifactId>maven-compiler-plugin</artifactId> >>>> <version>3.1</version> >>>> <configuration> >>>> <source>1.8</source> >>>> <target>1.8</target> >>>> <excludes> >>>> <exclude>columnGeneration/tsp/**</exclude> >>>> </excludes> >>>> </configuration> >>>> </plugin> >>>> >>>> Any suggestions are highly welcome! >>>> >>>> Joris >>>> >>>> On Tue, May 26, 2015 at 7:52 PM, Ron Wheeler < >>>> [email protected] >>>> >>>> wrote: >>>>> Why are these sources in the project if they don't need to be compiled? >>>>> Are they really java sources? >>>>> If so, why don't they compile? If not, should they just be resources >>>>> rather than sources? >>>>> >>>>> Ron >>>>> >>>>> >>>>> On 26/05/2015 5:27 PM, Joris Kinable wrote: >>>>> >>>>> Dear, >>>>> >>>>>> I'm trying to set up my first maven project for my code which can be >>>>>> found >>>>>> here: >>>>>> https://github.com/jkinable/jorlib >>>>>> >>>>>> I have 3 pom files: >>>>>> https://github.com/jkinable/jorlib/blob/master/pom.xml >>>>>> https://github.com/jkinable/jorlib/blob/master/jorlib-core/pom.xml >>>>>> https://github.com/jkinable/jorlib/blob/master/jorlib-demo/pom.xml >>>>>> >>>>>> I would like to exclude all files in the following directory from both >>>>>> compilation and testing (but the sources need to be retained): >>>>>> jorlib-core/src/test/java/org/jorlib/frameworks/columnGeneration/tsp >>>>>> >>>>>> I've tried to include pretty much every <exclude> ... </exclude> >>>>>> pattern I >>>>>> could think of to the following plugins: >>>>>> <plugin> >>>>>> <groupId>org.apache.maven.plugins</groupId> >>>>>> <artifactId>maven-compiler-plugin</artifactId> >>>>>> <version>3.1</version> >>>>>> <configuration> >>>>>> <source>1.8</source> >>>>>> <target>1.8</target> >>>>>> </configuration> >>>>>> </plugin> >>>>>> in https://github.com/jkinable/jorlib/blob/master/pom.xml >>>>>> >>>>>> >>>>>> and >>>>>> >>>>>> <plugin> >>>>>> <groupId>org.apache.maven.plugins</groupId> >>>>>> <artifactId>maven-jar-plugin</artifactId> >>>>>> <version>2.4</version> >>>>>> <configuration> >>>>>> <archive> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> >>>>>> </archive> >>>>>> </configuration> >>>>>> </plugin> >>>>>> in https://github.com/jkinable/jorlib/blob/master/jorlib-core/pom.xml >>>>>> >>>>>> Yet "mvn package" keeps compiling (and crashing) on files in the >>>>>> directory >>>>>> jorlib-core/src/test/java/org/jorlib/frameworks/columnGeneration/tsp >>>>>> Any suggestions on how to solve this? >>>>>> >>>>>> Thank you, >>>>>> >>>>>> Joris >>>>>> >>>>>> >>>>>> -- >>>>>> >>>>> Ron Wheeler >>>>> President >>>>> Artifact Software Inc >>>>> email: [email protected] >>>>> skype: ronaldmwheeler >>>>> phone: 866-970-2435, ext 102 >>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: [email protected] >>>>> For additional commands, e-mail: [email protected] >>>>> >>>>> >>>>> >>>>> -- >>> Ron Wheeler >>> President >>> Artifact Software Inc >>> email: [email protected] >>> skype: ronaldmwheeler >>> phone: 866-970-2435, ext 102 >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> >>> >>> > > -- > Ron Wheeler > President > Artifact Software Inc > email: [email protected] > skype: ronaldmwheeler > phone: 866-970-2435, ext 102 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
