Skip to content

Commit fa648cf

Browse files
committed
Merge branch 'develop'
2 parents bbd5be3 + 6d8dd1b commit fa648cf

File tree

42 files changed

+208
-172
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+208
-172
lines changed

.maven-settings.xml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,14 @@
3737
<enabled>true</enabled>
3838
<updatePolicy>never</updatePolicy>
3939
</releases>
40-
<!-- workaround for https://github.com/mojohaus/build-helper-maven-plugin/issues/108
4140
<snapshots>
4241
<enabled>false</enabled>
4342
</snapshots>
44-
-->
4543
</repository>
4644

4745
<repository>
48-
<id>oss-snapshots</id>
49-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
46+
<id>sonatype-central-snapshots</id>
47+
<url>https://central.sonatype.com/repository/maven-snapshots</url>
5048
<layout>default</layout>
5149
<releases>
5250
<enabled>false</enabled>
@@ -88,8 +86,8 @@
8886
</pluginRepository>
8987

9088
<pluginRepository>
91-
<id>oss-snapshots</id>
92-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
89+
<id>sonatype-central-snapshots</id>
90+
<url>https://central.sonatype.com/repository/maven-snapshots</url>
9391
<layout>default</layout>
9492
<releases>
9593
<enabled>false</enabled>
@@ -125,7 +123,12 @@
125123

126124
<servers>
127125
<server>
128-
<id>ossrh</id>
126+
<id>sonatype-central</id>
127+
<username>${env.SONATYPE_USERNAME}</username>
128+
<password>${env.SONATYPE_PASSWORD}</password>
129+
</server>
130+
<server>
131+
<id>sonatype-central-snapshots</id>
129132
<username>${env.SONATYPE_USERNAME}</username>
130133
<password>${env.SONATYPE_PASSWORD}</password>
131134
</server>

changes.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@
2424
xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 https://maven.apache.org/xsd/changes-2.0.0.xsd">
2525
<body>
2626

27+
<release version="2.21.0" date="2025-06-18">
28+
<action type="add" dev="sseifert" issue="179">
29+
Content Package Post Processors: Add option "dependencyChainIgnore" to ignore a content package in the dependency chain, i.e. it does not play a role for this package in which order it is deployed compared to other packages.
30+
</action>
31+
<action type="update" dev="sseifert" issue="178">
32+
Omit CONGA file header in generated content packages and use single creation date.
33+
</action>
34+
<action type="update" dev="sseifert" issue="177">
35+
CONGA AEM Maven Plugin: Switch to JSR-330 annotations.
36+
</action>
37+
</release>
38+
2739
<release version="2.20.2" date="2025-04-02">
2840
<action type="update" dev="sseifert" issue="99">
2941
Switch to Johnzon 2.x and jakarta.json.

conga-aem-plugin/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
<parent>
2626
<groupId>io.wcm.devops.conga.plugins</groupId>
2727
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
28-
<version>2.20.2</version>
28+
<version>2.21.0</version>
2929
<relativePath>../parent/pom.xml</relativePath>
3030
</parent>
3131

3232
<groupId>io.wcm.devops.conga.plugins</groupId>
3333
<artifactId>io.wcm.devops.conga.plugins.aem</artifactId>
34-
<version>2.20.2</version>
34+
<version>2.21.0</version>
3535
<packaging>jar</packaging>
3636

3737
<name>CONGA AEM Plugin</name>

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/crypto/impl/AesCryptoSupport.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import javax.crypto.spec.IvParameterSpec;
3232
import javax.crypto.spec.SecretKeySpec;
3333

34-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
3534
import io.wcm.devops.conga.plugins.aem.crypto.CryptoSupport;
3635

3736
/**
@@ -96,7 +95,6 @@ private Cipher getCipher(int cipherMode, byte[] iv, Key key) throws GeneralSecur
9695
return cipher;
9796
}
9897

99-
@SuppressFBWarnings("DMI_RANDOM_USED_ONLY_ONCE")
10098
private byte[] generateIV() {
10199
byte[] iv = new byte[IV_SIZE];
102100
RANDOM.nextBytes(iv);

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/handlebars/helper/AbstractFilterHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
abstract class AbstractFilterHelper implements HelperPlugin<Object> {
3434

3535
@Override
36-
@SuppressWarnings("PMD.PreserveStackTrace")
36+
@SuppressWarnings({ "PMD.PreserveStackTrace", "PMD.AvoidThrowingNewInstanceOfSameException" })
3737
public final Object apply(Object context, Options options, HelperContext pluginContext) throws IOException {
3838
if (!(context instanceof Map)) {
3939
throw new IllegalArgumentException("Excpected map object for filter rule.");

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/handlebars/helper/AemCryptoEncryptHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public String getName() {
6363
}
6464

6565
@Override
66-
@SuppressWarnings({ "java:S3776", "java:S5411" }) // ignore complexity
66+
@SuppressWarnings({ "java:S3776", "java:S5411", "PMD.ExceptionAsFlowControl" }) // ignore complexity
6767
public Object apply(Object context, Options options, HelperContext pluginContext) throws IOException {
6868
if (context == null) {
6969
return null;

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/postprocessor/ContentPackageOptions.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,10 @@ private ContentPackageOptions() {
103103
*/
104104
public static final String PROPERTY_PACKAGE_ALLOW_INDEX_DEFINITIONS = "contentPackage.allowIndexDefinitions";
105105

106+
/**
107+
* Ignore this package in dependency chain, i.e. it does not play a role for this package in which order
108+
* it is deployed compared to other packages.
109+
*/
110+
public static final String PROPERTY_DEPENCY_CHAIN_IGNORE = "dependencyChainIgnore";
111+
106112
}

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/postprocessor/ContentPackageOsgiConfigPostProcessor.java

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import java.io.IOException;
2929
import java.io.InputStream;
3030
import java.io.OutputStream;
31-
import java.nio.charset.StandardCharsets;
3231
import java.nio.file.Files;
3332
import java.util.Dictionary;
3433
import java.util.HashMap;
@@ -40,11 +39,9 @@
4039
import org.apache.sling.provisioning.model.Model;
4140
import org.slf4j.Logger;
4241

43-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
4442
import io.wcm.devops.conga.generator.GeneratorException;
4543
import io.wcm.devops.conga.generator.plugins.postprocessor.AbstractPostProcessor;
4644
import io.wcm.devops.conga.generator.spi.context.FileContext;
47-
import io.wcm.devops.conga.generator.spi.context.FileHeaderContext;
4845
import io.wcm.devops.conga.generator.spi.context.PostProcessorContext;
4946
import io.wcm.devops.conga.plugins.aem.util.ContentPackageUtil;
5047
import io.wcm.devops.conga.plugins.sling.postprocessor.JsonOsgiConfigPostProcessor;
@@ -78,16 +75,12 @@ public boolean accepts(FileContext file, PostProcessorContext context) {
7875
}
7976

8077
@Override
81-
@SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
8278
public List<FileContext> apply(FileContext fileContext, PostProcessorContext context) {
8379
File file = fileContext.getFile();
8480
Logger logger = context.getLogger();
8581
Map<String, Object> options = context.getOptions();
8682

8783
try {
88-
// extract file header
89-
FileHeaderContext fileHeader = extractFileHeader(fileContext, context);
90-
9184
// generate OSGi configurations
9285
Model model;
9386
if (ProvisioningUtil.isProvisioningFile(fileContext)) {
@@ -107,15 +100,15 @@ public List<FileContext> apply(FileContext fileContext, PostProcessorContext con
107100

108101
String rootPath = ContentPackageUtil.getMandatoryProp(options, PROPERTY_PACKAGE_ROOT_PATH);
109102

110-
ContentPackageBuilder builder = ContentPackageUtil.getContentPackageBuilder(options, context.getUrlFileManager(), fileHeader);
103+
ContentPackageBuilder builder = ContentPackageUtil.getContentPackageBuilder(options, context.getUrlFileManager());
111104

112105
// set package type depending on if config is present or not
113106
builder.packageType(hasAnyConfig ? "container" : "application");
114107

115108
try (ContentPackage contentPackage = builder.build(zipFile)) {
116109
if (hasAnyConfig) {
117110
// generate OSGI config files
118-
generateOsgiConfigurations(model, contentPackage, rootPath, fileHeader, context);
111+
generateOsgiConfigurations(model, contentPackage, rootPath, context);
119112
}
120113
else {
121114
// create folder for root path if package is empty otherwise
@@ -144,15 +137,13 @@ public List<FileContext> apply(FileContext fileContext, PostProcessorContext con
144137
* @param model Provisioning Model
145138
* @param contentPackage Content package
146139
* @param rootPath Root path
147-
* @param fileHeader File header
148140
* @param context Post processor context
149141
* @return true if any config file was added
150142
*/
151143
private boolean generateOsgiConfigurations(Model model, ContentPackage contentPackage,
152-
String rootPath, FileHeaderContext fileHeader, PostProcessorContext context) throws IOException {
144+
String rootPath, PostProcessorContext context) throws IOException {
153145
List<Void> result = ProvisioningUtil.visitOsgiConfigurations(model, new ConfigConsumer<Void>() {
154146
@Override
155-
@SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
156147
@SuppressWarnings("java:S3457") // log placeholders
157148
public Void accept(String path, Dictionary<String, Object> properties) throws IOException {
158149
String contentPath = rootPath + (StringUtils.contains(path, "/") ? "." : "/") + path;
@@ -164,11 +155,6 @@ public Void accept(String path, Dictionary<String, Object> properties) throws IO
164155
OsgiConfigUtil.write(os, properties);
165156
}
166157
try {
167-
FileContext tempFileContext = new FileContext().file(tempFile).charset(StandardCharsets.UTF_8);
168-
169-
// apply file header
170-
applyFileHeader(tempFileContext, fileHeader, context);
171-
172158
// write configuration to content package
173159
try (InputStream is = new BufferedInputStream(new FileInputStream(tempFile))) {
174160
contentPackage.addFile(contentPath, is);

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/postprocessor/ContentPackagePostProcessor.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@
3232
import org.apache.commons.io.FilenameUtils;
3333
import org.slf4j.Logger;
3434

35-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
3635
import io.wcm.devops.conga.generator.GeneratorException;
3736
import io.wcm.devops.conga.generator.plugins.postprocessor.AbstractPostProcessor;
3837
import io.wcm.devops.conga.generator.spi.context.FileContext;
39-
import io.wcm.devops.conga.generator.spi.context.FileHeaderContext;
4038
import io.wcm.devops.conga.generator.spi.context.PostProcessorContext;
4139
import io.wcm.devops.conga.generator.util.FileUtil;
4240
import io.wcm.devops.conga.plugins.aem.util.ContentPackageBinaryFile;
@@ -72,23 +70,19 @@ public boolean accepts(FileContext file, PostProcessorContext context) {
7270
}
7371

7472
@Override
75-
@SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
7673
public List<FileContext> apply(FileContext fileContext, PostProcessorContext context) {
7774
File file = fileContext.getFile();
7875
Logger logger = context.getLogger();
7976
Map<String, Object> options = context.getOptions();
8077

8178
try {
82-
// extract file header
83-
FileHeaderContext fileHeader = extractFileHeader(fileContext, context);
84-
8579
// create AEM content package with configurations
8680
File zipFile = new File(file.getParentFile(), FilenameUtils.getBaseName(file.getName()) + ".zip");
8781
logger.info("Generate {}", zipFile.getCanonicalPath());
8882

8983
String rootPath = ContentPackageUtil.getMandatoryProp(options, PROPERTY_PACKAGE_ROOT_PATH);
9084

91-
ContentPackageBuilder builder = ContentPackageUtil.getContentPackageBuilder(options, context.getUrlFileManager(), fileHeader);
85+
ContentPackageBuilder builder = ContentPackageUtil.getContentPackageBuilder(options, context.getUrlFileManager());
9286
try (ContentPackage contentPackage = builder.build(zipFile)) {
9387

9488
// add content from JSON file

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/postprocessor/ContentPackagePropertiesPostProcessor.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020
package io.wcm.devops.conga.plugins.aem.postprocessor;
2121

22+
import static io.wcm.devops.conga.plugins.aem.postprocessor.ContentPackageOptions.PROPERTY_DEPENCY_CHAIN_IGNORE;
2223
import static io.wcm.devops.conga.plugins.aem.postprocessor.ContentPackageOptions.PROPERTY_PACKAGE_PACKAGE_TYPE;
2324
import static org.apache.jackrabbit.vault.packaging.PackageProperties.NAME_PACKAGE_TYPE;
2425

@@ -54,6 +55,11 @@ public class ContentPackagePropertiesPostProcessor extends AbstractPostProcessor
5455
*/
5556
public static final String MODEL_OPTIONS_PROPERTY = "aemContentPackageProperties";
5657

58+
/**
59+
* Marks content package to be ignored in dependency chain.
60+
*/
61+
public static final String DEPENDENCY_CHAIN_IGNORE_PROPERTY = "aemContentPackageDepenencyChainIgnore";
62+
5763
private static final String FILE_EXTENSION = "zip";
5864
private static final String ALTERNATE_FILE_EXTENSION = "jar";
5965

@@ -94,6 +100,12 @@ public List<FileContext> apply(FileContext fileContext, PostProcessorContext con
94100
}
95101

96102
fileContext.getModelOptions().put(MODEL_OPTIONS_PROPERTY, properties);
103+
104+
boolean dependencyChainIgnore = ContentPackageUtil.getOptionalPropBoolean(context.getOptions(), PROPERTY_DEPENCY_CHAIN_IGNORE);
105+
if (dependencyChainIgnore) {
106+
fileContext.getModelOptions().put(DEPENDENCY_CHAIN_IGNORE_PROPERTY, true);
107+
}
108+
97109
logger.info("Extracted properties from AEM content package.");
98110
}
99111
}

0 commit comments

Comments
 (0)