Skip to content

Commit cb13614

Browse files
committed
Merge branch 'develop' into master
2 parents c9a66ce + b45da12 commit cb13614

22 files changed

Lines changed: 1109 additions & 37 deletions

File tree

.github/workflows/maven-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ jobs:
4444
4545
# Build & install (required for 2nd build: example)
4646
- name: Build and verify
47-
run: mvn -s ./.maven-settings.xml -Pcontinuous-integration -B -U clean install
47+
run: ./mvnw -s ./.maven-settings.xml -Pcontinuous-integration -B -U clean install
4848

4949
# Build & verify example
5050
- name: Build and verify example
51-
run: mvn -s ./.maven-settings.xml -Pcontinuous-integration -B -U clean verify -f example
51+
run: ./mvnw -s ./.maven-settings.xml -Pcontinuous-integration -B -U clean verify -f example
5252

5353
# Run code coverage check
5454
- name: Run code coverage check

.github/workflows/maven-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ jobs:
4444
env:
4545
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
4646
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
47-
run: mvn -s ./.maven-settings.xml -Pcontinuous-integration -B -U clean deploy site
47+
run: ./mvnw -s ./.maven-settings.xml -Pcontinuous-integration -B -U clean deploy site
4848

4949
# Deploy site to Github Pages
5050
- name: Stage and deploy site
5151
run: >
52-
mvn -s ./.maven-settings.xml -Pcontinuous-integration -B site:stage scm-publish:publish-scm
52+
./mvnw -s ./.maven-settings.xml -Pcontinuous-integration -B site:stage scm-publish:publish-scm
5353
-Dscmpublish.checkinComment="Maven site: ${{ github.repository }}"
5454
-Dusername=${{ secrets.GH_SITE_DEPLOY_USERNAME }}
5555
-Dpassword=${{ secrets.GH_SITE_DEPLOY_PAT }}
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/*
2+
* Copyright 2007-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
import java.net.*;
17+
import java.io.*;
18+
import java.nio.channels.*;
19+
import java.util.Properties;
20+
21+
public class MavenWrapperDownloader {
22+
23+
private static final String WRAPPER_VERSION = "0.5.6";
24+
/**
25+
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26+
*/
27+
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28+
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29+
30+
/**
31+
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32+
* use instead of the default one.
33+
*/
34+
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35+
".mvn/wrapper/maven-wrapper.properties";
36+
37+
/**
38+
* Path where the maven-wrapper.jar will be saved to.
39+
*/
40+
private static final String MAVEN_WRAPPER_JAR_PATH =
41+
".mvn/wrapper/maven-wrapper.jar";
42+
43+
/**
44+
* Name of the property which should be used to override the default download url for the wrapper.
45+
*/
46+
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47+
48+
public static void main(String args[]) {
49+
System.out.println("- Downloader started");
50+
File baseDirectory = new File(args[0]);
51+
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52+
53+
// If the maven-wrapper.properties exists, read it and check if it contains a custom
54+
// wrapperUrl parameter.
55+
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56+
String url = DEFAULT_DOWNLOAD_URL;
57+
if(mavenWrapperPropertyFile.exists()) {
58+
FileInputStream mavenWrapperPropertyFileInputStream = null;
59+
try {
60+
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61+
Properties mavenWrapperProperties = new Properties();
62+
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63+
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64+
} catch (IOException e) {
65+
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66+
} finally {
67+
try {
68+
if(mavenWrapperPropertyFileInputStream != null) {
69+
mavenWrapperPropertyFileInputStream.close();
70+
}
71+
} catch (IOException e) {
72+
// Ignore ...
73+
}
74+
}
75+
}
76+
System.out.println("- Downloading from: " + url);
77+
78+
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79+
if(!outputFile.getParentFile().exists()) {
80+
if(!outputFile.getParentFile().mkdirs()) {
81+
System.out.println(
82+
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83+
}
84+
}
85+
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86+
try {
87+
downloadFileFromURL(url, outputFile);
88+
System.out.println("Done");
89+
System.exit(0);
90+
} catch (Throwable e) {
91+
System.out.println("- Error downloading");
92+
e.printStackTrace();
93+
System.exit(1);
94+
}
95+
}
96+
97+
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98+
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99+
String username = System.getenv("MVNW_USERNAME");
100+
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101+
Authenticator.setDefault(new Authenticator() {
102+
@Override
103+
protected PasswordAuthentication getPasswordAuthentication() {
104+
return new PasswordAuthentication(username, password);
105+
}
106+
});
107+
}
108+
URL website = new URL(urlString);
109+
ReadableByteChannel rbc;
110+
rbc = Channels.newChannel(website.openStream());
111+
FileOutputStream fos = new FileOutputStream(destination);
112+
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113+
fos.close();
114+
rbc.close();
115+
}
116+
117+
}

.mvn/wrapper/maven-wrapper.jar

49.5 KB
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
2+
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

changes.xml

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

26+
<release version="1.15.0" date="2021-09-20">
27+
<action type="add" dev="sseifert">
28+
Content Package Validator: Load default node types for validation from biz.netcentric.aem:aem-nodetypes and io.wcm.tooling.nodetypes:io.wcm.tooling.nodetypes.wcmio.
29+
</action>
30+
<action type="update" dev="sseifert">
31+
Content Package Validator: Update to filevault-package-maven-plugin 1.1.8.
32+
</action>
33+
<action type="update" dev="sseifert">
34+
conga-aem-maven-plugin:cloudmanager-all-package: Ensure dependencies of sub packages are managed as well.
35+
</action>
36+
</release>
37+
2638
<release version="1.14.6" date="2021-06-27">
2739
<action type="update" dev="sseifert">
2840
conga-aem-maven-plugin:cloudmanager-all-package: Extract nested sub packages and treat them in the same way as the other packages (managing dependencies and run modes).

conga-aem-plugin/pom.xml

Lines changed: 12 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>1.14.6</version>
28+
<version>2.15.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>1.14.6</version>
34+
<version>2.15.0</version>
3535
<packaging>jar</packaging>
3636

3737
<name>CONGA AEM Plugin</name>
@@ -92,6 +92,16 @@
9292
</exclusion>
9393
</exclusions>
9494
</dependency>
95+
<dependency>
96+
<groupId>biz.netcentric.aem</groupId>
97+
<artifactId>aem-nodetypes</artifactId>
98+
<scope>compile</scope>
99+
</dependency>
100+
<dependency>
101+
<groupId>io.wcm.tooling.nodetypes</groupId>
102+
<artifactId>io.wcm.tooling.nodetypes.wcmio</artifactId>
103+
<scope>compile</scope>
104+
</dependency>
95105

96106
<dependency>
97107
<groupId>io.wcm.tooling.commons</groupId>

conga-aem-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/validator/ContentPackageValidator.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,16 @@
3535
import org.apache.maven.plugin.MojoExecutionException;
3636
import org.apache.maven.plugin.MojoFailureException;
3737

38+
import com.google.common.collect.ImmutableMap;
39+
3840
import io.wcm.devops.conga.generator.spi.ImplicitApplyOptions;
3941
import io.wcm.devops.conga.generator.spi.ValidationException;
4042
import io.wcm.devops.conga.generator.spi.ValidatorPlugin;
4143
import io.wcm.devops.conga.generator.spi.context.FileContext;
4244
import io.wcm.devops.conga.generator.spi.context.ValidatorContext;
4345
import io.wcm.devops.conga.generator.util.FileUtil;
4446
import io.wcm.devops.conga.model.util.MapExpander;
47+
import io.wcm.devops.conga.model.util.MapMerger;
4548
import io.wcm.devops.conga.tooling.maven.plugin.util.MavenContext;
4649
import io.wcm.tooling.commons.packmgr.util.ContentPackageProperties;
4750

@@ -59,6 +62,10 @@ public class ContentPackageValidator implements ValidatorPlugin {
5962

6063
private static final String OPTION_VALIDATORS_SETTINGS = "contentPackage.validatorsSettings";
6164

65+
// apply default validation for AEM and wcm.io node types
66+
private static final Map<String, Object> DEFAULT_VALIDATORS_SETTINGS = ImmutableMap.of("jackrabbit-nodetypes",
67+
ImmutableMap.of("options", ImmutableMap.of("cnds", "tccl:aem.cnd,tccl:wcmio.cnd")));
68+
6269
@Override
6370
public String getName() {
6471
return NAME;
@@ -114,9 +121,11 @@ private void validateContentPackage(File packageFile, ValidatorContext context,
114121
setProperty(mojo, "repositorySystem", mavenContext.getRepositorySystem());
115122
setProperty(mojo, "resolutionErrorHandler", mavenContext.getResolutionErrorHandler());
116123
setProperty(mojo, "buildContext", mavenContext.getBuildContext());
124+
setProperty(mojo, "attachedArtifacts", Collections.emptyList());
117125

118126
Object validatorsSettings = MapExpander.getDeep(context.getOptions(), OPTION_VALIDATORS_SETTINGS);
119-
setProperty(mojo, "validatorsSettings", toValidatorsSettings(toMap(validatorsSettings)));
127+
Map<String,Object> validatorSettingsMap = MapMerger.merge(toMap(validatorsSettings), DEFAULT_VALIDATORS_SETTINGS);
128+
setProperty(mojo, "validatorsSettings", toValidatorsSettings(validatorSettingsMap));
120129

121130
mojo.execute();
122131
}

example/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<dependency>
6666
<groupId>io.wcm.devops.conga.plugins</groupId>
6767
<artifactId>io.wcm.devops.conga.plugins.aem</artifactId>
68-
<version>1.14.5-SNAPSHOT</version>
68+
<version>1.14.7-SNAPSHOT</version>
6969
</dependency>
7070

7171
</dependencies>

example/src/main/roles/aem.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,24 @@ files:
8282
filters:
8383
- filter: /etc/replication/agents.author
8484

85+
# Oak Index
86+
- file: aem-cms-oak-index.json
87+
dir: packages
88+
template: aem-cms-oak-index.json.hbs
89+
postProcessors:
90+
- aem-contentpackage
91+
postProcessorOptions:
92+
contentPackage:
93+
name: schindler-aem-aem-cms-oak-index
94+
packageType: application
95+
rootPath: /oak:index
96+
allowIndexDefinitions: true
97+
validatorOptions:
98+
contentPackage.validatorsSettings:
99+
jackrabbit-packagetype:
100+
options:
101+
immutableRootNodeNames: apps,libs,oak:index
102+
85103
# Download AEM content package and extract properties
86104
- url: mvn:io.wcm/io.wcm.caconfig.editor.package//zip
87105
dir: packages

0 commit comments

Comments
 (0)