Re: Getting project classes from plugin

2016-09-08 Thread Christopher
If it helps anybody else, I ended up using Guava's ClassInfo.getResourceName() and concatenated that with project.getBuild().get[Test]OutputDirectory() and checked that with File.exists(). I then encapsulated that in a Java 8 Predicate called "isProjectClass()" and used that as a Java 8 Stream filt

Re: Getting project classes from plugin

2016-09-05 Thread Christopher
Unfortunately, using project.getBuild().getOutputDirectory() doesn't work either. The classloader I created from that still contains other classes, like plexus, and jdk classes. Additionally, because it didn't have the dependencies, some of the annotations I need to process weren't loaded by the cl

Re: Getting project classes from plugin

2016-09-05 Thread Guillaume Boué
Hi, You should be able to get only the project compiled classes with project.getBuild().getOutputDirectory(). Internally, this is what getCompileClasspathElements does. For the test classpath, you have the similar project.getBuild().getTestOutputDirectory(). With those two folders, you can c

Re: Getting project classes from plugin

2016-09-05 Thread Francois-Xavier Bonnet
When I wrote builder-maven-plugin I had to do things with some project classes. What I did was scan the source code and then load the corresponding .class for each .java file found. Maybe you could do the same. The code is here: https://github.com/javabuild/builder-par

Re: Getting project classes from plugin

2016-09-04 Thread Barrie Treloar
On 5 September 2016 at 12:11, Christopher wrote: > Hi, > > I'm trying to write a Maven plugin which gets, and processes, a list of > classes from the project. I want to be able to get the project classes > compiled from either src/main/java (compile scope), and src/test/java (test > scope, minus

Getting project classes from plugin

2016-09-04 Thread Christopher
Hi, I'm trying to write a Maven plugin which gets, and processes, a list of classes from the project. I want to be able to get the project classes compiled from either src/main/java (compile scope), and src/test/java (test scope, minus compile scope), depending on user configuration. So far, the