You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Michael Patel <Mi...@betgenius.com> on 2012/07/05 13:41:53 UTC

Can maven site plugins access processed classes ?

Can a maven reporting plugin, executed during the site phase, access classes from the executing maven project. If so, how.

I thought about using the following

       public Set<Class<?>> findControllerClasses(File buildOutputDir) throws IOException, ClassNotFoundException {

              Collection<URL> urls = ClasspathHelper.forJavaClassPath();
              if (buildOutputDir != null) {
                     urls.add(buildOutputDir.toURI().toURL());
              }

              Reflections reflections = new Reflections(new ConfigurationBuilder().setUrls(urls).setScanners(new ResourcesScanner(), new TypeAnnotationsScanner(), new SubTypesScanner()));
              Set<Class<?>> types = new HashSet<Class<?>>();
              types.addAll(reflections.getTypesAnnotatedWith(Controller.class));
              return types;
       }

But this is not possible.

Mike.