kwin commented on code in PR #42:
URL:
https://github.com/apache/sling-org-apache-sling-feature-analyser/pull/42#discussion_r1048539916
##########
src/main/java/org/apache/sling/feature/scanner/impl/ContentPackageScanner.java:
##########
@@ -377,6 +371,38 @@ private ArtifactId extractArtifactId(final File tempDir,
final File bundleFile)
throw new IOException(bundleFile.getName() + " has no maven
coordinates!");
}
+ private static File getGroupDir(File mavenDir, ArtifactId
packageArtifactId) {
+ File groupDir = null;
+ List<File> candidateDirectories = new ArrayList<>();
+
+ for(final File d : mavenDir.listFiles()) {
+ if ( d.isDirectory() && !d.getName().startsWith(".") ) {
+ candidateDirectories.add(d);
+ }
+ }
+
+ if ( candidateDirectories.isEmpty() ) {
+ return null;
+ }
+ if ( candidateDirectories.size() == 1 ) {
+ return candidateDirectories.get(0);
+ } else {
+ // if we have multiple directories, we have the case where
dependency's maven properties are injected alongside the package maven
properties.
+ // for example in acs aem commons 5.3.4 we find com.google.guava.
+ // in this case, let's try to get the appropriate group directory
by using the artifactId.
+ for(File candidateDir: candidateDirectories){
+
if(candidateDir.getName().equals(packageArtifactId.getGroupId())){
+ return candidateDir;
Review Comment:
let us add some logging here to ease debugging
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]