try {
Artifact artifact = project.getArtifact();
String type = testJar ? ARTIFACTTYPE_TEST_JAR : artifact.getType();
String id = createArtifactDescriptorId(artifact.getGroupId(), artifact.getArtifactId(), type, artifact.getClassifier(),
artifact.getVersion());
ArtifactDescriptor artifactDescriptor = store.find(ArtifactDescriptor.class, id);
if (artifactDescriptor == null) {
artifactDescriptor = store.create(ArtifactDescriptor.class, id);
artifactDescriptor.setGroup(artifact.getGroupId());
artifactDescriptor.setName(artifact.getArtifactId());
artifactDescriptor.setVersion(artifact.getVersion());
artifactDescriptor.setClassifier(artifact.getClassifier());
artifactDescriptor.setType(type);
}
FileScanner scanner = new FileScannerImpl(store, scannerPlugins);
try {
for (Descriptor descriptor : scanner.scanDirectory(directory)) {
artifactDescriptor.getContains().add(descriptor);
}
} catch (IOException e) {
throw new MojoExecutionException("Cannot scan directory '" + directory.getAbsolutePath() + "'", e);
}
} finally {