/** * Here we will look if we find a local Maven repository at * {@code $user.home/.m2/repository} with a aspectjrt-x.x.x.jar * inside. * * @since 1.0 * @return null if nothing was found */ @MayReturnNull private static File getAspectjPathFromRepository() { try { File mavenRepoDir = Environment.getLocalMavenRepositoryDir(); File repo = new File(mavenRepoDir, "org/aspectj/aspectjrt"); String[] subdirs = repo.list(); if (subdirs == null) { LOG.trace("Will return null because {} is not a directory.", repo); return null; } Arrays.sort(subdirs); for (int i = subdirs.length-1; i >= 0; i--) { File aspectjPath = getAspectjPathFrom(new File(repo, subdirs[i])); if (aspectjPath != null) { return aspectjPath; } } } catch (IOException ioe) { LOG.warn("Local maven repository not found.", ioe); } return null; }