my attempt was
classloader cl = classloader.getsystemclassloader(); url[] currentclasspath = ((urlclassloader) cl).geturls(); string[] classpathstrings = arrays.stream(currentclasspath).map(url -> { try { return paths.get(url.touri()).toabsolutepath().tostring(); } catch (urisyntaxexception e) { throw new runtimeexception(e); } }).toarray(string[]::new); system.out.println(arrays.aslist(classpathstrings)); in annotation processor's process() method body. outputs only
[c:\program files\maven\boot\plexus-classworlds-2.5.1.jar]
instead of dependencies of processed project.
well, it's enough use getclass().getclassloader(). getclass() in annotation processor context.
Comments
Post a Comment