in src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java [289:351]
private void extractConfiguration(final Artifact artifact) throws MojoExecutionException, IOException {
// check for configuration artifact
Artifact cfgArtifact = null;
try {
cfgArtifact = getArtifact(artifact.getGroupId(),
artifact.getArtifactId(),
artifact.getVersion(),
AttachPartialBundleListMojo.CONFIG_TYPE,
AttachPartialBundleListMojo.CONFIG_CLASSIFIER);
} catch (final MojoExecutionException ignore) {
// we just ignore this
}
if ( cfgArtifact != null ) {
getLog().info(
String.format("Merging settings from partial bundle list %s:%s:%s", cfgArtifact.getGroupId(),
cfgArtifact.getArtifactId(), cfgArtifact.getVersion()));
// extract
zipUnarchiver.setSourceFile(cfgArtifact.getFile());
try {
this.tmpOutputDir.mkdirs();
zipUnarchiver.setDestDirectory(this.tmpOutputDir);
zipUnarchiver.extract();
final File slingDir = new File(this.tmpOutputDir, "sling");
this.readSlingProperties(new File(slingDir, AttachPartialBundleListMojo.SLING_COMMON_PROPS), 0);
this.readSlingProperties(new File(slingDir, AttachPartialBundleListMojo.SLING_WEBAPP_PROPS), 1);
this.readSlingProperties(new File(slingDir, AttachPartialBundleListMojo.SLING_STANDALONE_PROPS), 2);
this.readSlingBootstrap(new File(slingDir, AttachPartialBundleListMojo.SLING_COMMON_BOOTSTRAP), 0);
this.readSlingBootstrap(new File(slingDir, AttachPartialBundleListMojo.SLING_WEBAPP_BOOTSTRAP), 1);
this.readSlingBootstrap(new File(slingDir, AttachPartialBundleListMojo.SLING_STANDALONE_BOOTSTRAP), 2);
// and now configurations
final File configDir = new File(this.tmpOutputDir, "config");
if ( configDir.exists() ) {
if ( this.overlayConfigDir == null ) {
this.tempConfigDir.mkdirs();
this.overlayConfigDir = this.tempConfigDir;
}
final String[] defaultExcludes = FileUtils.getDefaultExcludes();
String[] excludes;
if ( this.configExcludes != null ) {
excludes = new String[defaultExcludes.length + this.configExcludes.length];
System.arraycopy(defaultExcludes, 0, excludes, 0, defaultExcludes.length);
System.arraycopy(this.configExcludes, 0, excludes, defaultExcludes.length, this.configExcludes.length);
} else {
excludes = defaultExcludes;
}
String[] includes = null;
if ( this.configIncludes != null ) {
includes = this.configIncludes;
}
copyDirectory(configDir, this.overlayConfigDir,
includes, excludes);
}
} catch (final ArchiverException ae) {
throw new MojoExecutionException("Unable to extract configuration archive.",ae);
} finally {
// and delete at the end
FileUtils.deleteDirectory(this.tmpOutputDir);
}
}
}