sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andy...@apache.org
Subject [sling-project-archetype] branch master updated: Fixes for issues with default parameters and embedded bundles
Date Sat, 04 May 2019 18:22:26 GMT
This is an automated email from the ASF dual-hosted git repository.

andysch pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-project-archetype.git


The following commit(s) were added to refs/heads/master by this push:
     new 52a6086  Fixes for issues with default parameters and embedded bundles
52a6086 is described below

commit 52a60864c420b05ebb06994d0479f0626319195b
Author: Andreas Schaefer <achaefa@Andreass-iMac.local>
AuthorDate: Sat May 4 11:16:29 2019 -0700

    Fixes for issues with default parameters and embedded bundles
---
 README.md                                          | 28 +++++----
 build.run.and.deploy.test.sh                       | 69 ++++++++++++++++------
 .../META-INF/maven/archetype-metadata.xml          | 28 +++++----
 .../.archetype-config/archetype.properties         |  7 ++-
 src/main/resources/archetype-resources/pom.xml     |  2 +-
 .../archetype-resources/ui.apps.example/pom.xml    | 29 ++++-----
 .../resources/archetype-resources/ui.apps/pom.xml  | 29 ++++-----
 .../resources/projects/all/archetype.properties    | 16 ++---
 .../projects/allDeleted/archetype.properties       | 16 ++---
 .../projects/allMerged/archetype.properties        | 16 ++---
 .../resources/projects/notAll/archetype.properties | 16 ++---
 .../projects/notAllDeleted/archetype.properties    | 16 ++---
 .../projects/notAllMerged/archetype.properties     | 16 ++---
 13 files changed, 159 insertions(+), 129 deletions(-)

diff --git a/README.md b/README.md
index ea77fbd..5240d58 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,12 @@
-### Sling Template through Maven Archetype
+### Sling Project Template through Maven Archetype
 
+#### Releases
+
+| Version | Description |
+|:--------|:------------|
+|1.0.0    |Initial Release. Do not use anymore as it has issues with handling embedded bundles|
+|1.0.1    |Fixes for the embedded bundles issue and prevents the interactive mode to fail
to ask for certain parameters by having no defaults|
+ 
 #### Introduction
 
 This archetype will create a Sling project that can be deployed on the Sling 10. In contrast
to
@@ -40,10 +47,10 @@ how to build and deploy the entire project in one step.
 |artifactId           |Maven Artifact Id|
 |version              |Version of your project|
 |artifactName         |Project Label used in the Descriptions and Module Name|
-|packageGroup         |Name of the Package Folder where the ui.apps is installed in (/etc/packages)|
+|package              |Root Package of the Java Code|
+|packageGroup         |Name of the Package Folder where the package is installed in (/etc/packages)|
 |appsFolderName       |Folder name under /apps where components etc are installed|
 |contentFolderName    |Folder name under /content where the content is added to|
-|package              |Root Package of the Java Code|
 |slingModelSubPackage |Sub Package where Sling Models should be place in with no trailing
dots|
 |slingHostName        |Host Name or IP Address of the server where Sling is hosted|
 |slingPort            |Port to which your Sling instance is bound to|
@@ -57,7 +64,7 @@ You can create a project with this archetype using this command:
 mvn archetype:generate \
    -DarchetypeGroupId=org.apache.sling \
    -DarchetypeArtifactId=sling-project-archetype \
-   -DarchetypeVersion=1.0.0
+   -DarchetypeVersion=1.0.1
 ```
 Maven will then guide you through the configuration process to fill in all the
 properties and then create the project.
@@ -82,13 +89,14 @@ There is a simple integration test setup with this archetype.
 This script will build both the Merged All and UI (ui.apps packaging) and install them on
the
 local Sling instance. The resulting pages (from the example code) can be viewed here:
 
-* [All Home](http://localhost:8080/content/testContentAll/home.html)
-* [UI Home](http://localhost:8080/content/testContentUI/home.html)
+* [All Merged Home](http://localhost:8080/content/testContentAllMer/home.html)
+* [UI Merged Home](http://localhost:8080/content/testContentUIMer/home.html)
 
-You can run this one using the attached Unix shell script:
-
-    sh build.run.and.deploy.test.sh
+You can run this all of these test projects using the attached Unix shell script:
+```
+sh build.run.and.deploy.test.sh
+```
 
 The properties for the integration test can be found under
-**/test/resources/projects/[all/notAll]/archetype.properties**.
+**/test/resources/projects/\[all/notAll\]/archetype.properties**.
 
diff --git a/build.run.and.deploy.test.sh b/build.run.and.deploy.test.sh
index 98908ab..c078542 100755
--- a/build.run.and.deploy.test.sh
+++ b/build.run.and.deploy.test.sh
@@ -19,33 +19,66 @@
 
 dir=`pwd`
 echo "Build the Sling Project Archetype in folder: $dir"
-mvn clean install
-
-testFolder=$dir/target/test-classes/projects/allMerged/project/sample-test-all
 
-echo
-echo
-echo "--------------------------------------------------"
-echo "   Build and Deploy the All (Merged) Test Project"
-echo "--------------------------------------------------"
-echo
-echo
+# Parameters:
+# 1. Path to test project folder
+# 2. Is this a package or all project: true or false
+# 3. Type of project: s: separated, m: merged, d: ditched
+function doProject {
+    if [ "$2" == "true" ]; then
+       profile="autoInstallPackage"
+    else
+       profile="autoInstallAll"
+    fi
+    if [ "$3" == "s" ]; then
+       type="Separated"
+    fi
+    if [ "$3" == "m" ]; then
+       type="Merged"
+    fi
+    if [ "$3" == "d" ]; then
+       type="Ditched"
+    fi
+    echo
+    echo
+    echo "--------------------------------------------------"
+    echo "   Build and Deploy Test Project"
+    echo
+    echo "   Path: $1"
+    echo "   Is Package: $2"
+    echo "   Type: $type"
+    echo "--------------------------------------------------"
+    echo
+    echo
 
-cd $testFolder
-mvn clean install -P autoInstallAll
+    if [ ! -d $1 ]; then
+        echo ">>>> Folder $1 does not exist <<<<"
+        quit
+    fi
 
-testFolder=$dir/target/test-classes/projects/notAllMerged/project/sample-test-ui
+    cd $1
+    pwd
+    ls -l
+    mvn clean install -P $profile
+}
 
+# Build and Install Archetype
 echo
 echo
-echo "---------------------------------------------------"
-echo "Build and Deploy the Not All (Merged) Test Project"
-echo "---------------------------------------------------"
+echo "------------------------------------------"
+echo "       Build and Install Archetype"
+echo "------------------------------------------"
 echo
 echo
+mvn clean install
+
+doProject $dir/target/test-classes/projects/all/project/sample-test-all-sep false s
+doProject $dir/target/test-classes/projects/allDeleted/project/sample-test-all-del false
d
+doProject $dir/target/test-classes/projects/allMerged/project/sample-test-all-mer false m
 
-cd $testFolder
-mvn clean install -P autoInstallPackage
+doProject $dir/target/test-classes/projects/notAll/project/sample-test-ui-sep true s
+doProject $dir/target/test-classes/projects/notAllDeleted/project/sample-test-ui-del true
d
+doProject $dir/target/test-classes/projects/notAllMerged/project/sample-test-ui-mer true
m
 
 echo
 echo
diff --git a/src/main/resources/META-INF/maven/archetype-metadata.xml b/src/main/resources/META-INF/maven/archetype-metadata.xml
index d8fac86..265f9ed 100644
--- a/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -24,9 +24,9 @@
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 >
     <requiredProperties>
-        <requiredProperty key="version">
-            <defaultValue>1.0.0-SNAPSHOT</defaultValue>
-        </requiredProperty>
+<!--        <requiredProperty key="version">-->
+<!--            <defaultValue>1.0.0-SNAPSHOT</defaultValue>-->
+<!--        </requiredProperty>-->
 
         <!--
            The Project Label used a prefix to the name of modules and is part of the descriptions
@@ -36,9 +36,9 @@
            This is the folder name of the group underneath of /etc/packages where the content
package
            is installed
         -->
-        <requiredProperty key="packageGroup">
-            <defaultValue>${groupId}</defaultValue>
-        </requiredProperty>
+<!--        <requiredProperty key="packageGroup">-->
+<!--            <defaultValue>${groupId}</defaultValue>-->
+<!--        </requiredProperty>-->
         <!--
             The folder name underneath /apps where components etc is installed from content
packages.
             This folder separates projects from each other and should be unique within your
deployment
@@ -54,7 +54,13 @@
             Package of the generated Service classes
         -->
         <requiredProperty key="package">
-            <defaultValue>${groupId}</defaultValue>
+<!--            <defaultValue>${groupId}</defaultValue>-->
+        </requiredProperty>
+        <!--
+            Group Name under which the Package is installed (inside /etc)
+        -->
+        <requiredProperty key="packageGroup">
+<!--            <defaultValue>${groupId}</defaultValue>-->
         </requiredProperty>
         <!--
             Sub Package for the Sling Models (it is prepended with the package specified
above)
@@ -66,22 +72,22 @@
             Target Host Name or IP Address of the Deployment Sling Server
         -->
         <requiredProperty key="slingHostName">
-            <defaultValue>localhost</defaultValue>
+<!--            <defaultValue>localhost</defaultValue>-->
         </requiredProperty>
         <!--
             Target Port of the Deployment Sling Server
         -->
         <requiredProperty key="slingPort">
-            <defaultValue>8080</defaultValue>
+<!--            <defaultValue>8080</defaultValue>-->
         </requiredProperty>
         <!-- If set to yes a project is created with an All Packager rather than deploying
the bundle inside ui.apps -->
         <requiredProperty key="optionAll">
-            <defaultValue>n</defaultValue>
+<!--            <defaultValue>n</defaultValue>-->
             <validationRegex>^(y|n)$</validationRegex>
         </requiredProperty>
         <!-- Indicates if the examples should be a separate module, merged into or ditched
-->
         <requiredProperty key="optionExample">
-            <defaultValue>s</defaultValue>
+<!--            <defaultValue>s</defaultValue>-->
             <validationRegex>^(s|m|d)$</validationRegex>
         </requiredProperty>
     </requiredProperties>
diff --git a/src/main/resources/archetype-resources/.archetype-config/archetype.properties
b/src/main/resources/archetype-resources/.archetype-config/archetype.properties
index 062882a..621812f 100644
--- a/src/main/resources/archetype-resources/.archetype-config/archetype.properties
+++ b/src/main/resources/archetype-resources/.archetype-config/archetype.properties
@@ -21,14 +21,15 @@
 # This file contains all the properties you used
 # to build your project from the archetype
 #
-package=${package}
-version=${version}
 groupId=${groupId}
 artifactName=${artifactName}
+version=${version}
+package=${package}
 packageGroup=${packageGroup}
 appsFolderName=${appsFolderName}
 contentFolderName=${contentFolderName}
+optionExample=${optionExample}
+slingModelSubPackage=${slingModelSubPackage}
 slingModelSubPackage=${slingModelSubPackage}
 slingHostName=${slingHostName}
 slingPort=${slingPort}
-optionAll=${optionAll}
diff --git a/src/main/resources/archetype-resources/pom.xml b/src/main/resources/archetype-resources/pom.xml
index 3cce2c5..0af65ff 100644
--- a/src/main/resources/archetype-resources/pom.xml
+++ b/src/main/resources/archetype-resources/pom.xml
@@ -240,7 +240,6 @@
                     <configuration>
                         <failOnMissingEmbed>true</failOnMissingEmbed>
                         <force>true</force>
-                        <group>\${packageGroup}</group>
                     </configuration>
                 </plugin>
                 <plugin>
@@ -399,6 +398,7 @@
                 <groupId>commons-lang</groupId>
                 <artifactId>commons-lang</artifactId>
                 <version>${commons-lang.version}</version>
+                <scope>provided</scope>
             </dependency>
 
             <!-- Basic dependencies for Unit Tests -->
diff --git a/src/main/resources/archetype-resources/ui.apps.example/pom.xml b/src/main/resources/archetype-resources/ui.apps.example/pom.xml
index 561a51c..7fdcc27 100644
--- a/src/main/resources/archetype-resources/ui.apps.example/pom.xml
+++ b/src/main/resources/archetype-resources/ui.apps.example/pom.xml
@@ -72,26 +72,17 @@
                 <artifactId>filevault-package-maven-plugin</artifactId>
                 <configuration>
                     <filterSource>\${basedir}/src/main/content/META-INF/vault/filter.xml</filterSource>
+                    <!-- @startForNotAll@ This is used for the Post Generation Handling.
Do not alter or remove -->
+                    <embeddedTarget>/apps/\${appsFolderName}/install</embeddedTarget>
+                    <embeddeds>
+                        <embedded>
+                            <groupId>\${project.groupId}</groupId>
+                            <artifactId>core</artifactId>
+                            <filter>true</filter>
+                        </embedded>
+                    </embeddeds>
+                    <!-- @endForNotAll@ This is used for the Post Generation Handling.
Do not alter or remove -->
                 </configuration>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>package</goal>
-                        </goals>
-                        <!-- @startForNotAll@ This is used for the Post Generation Handling.
Do not alter or remove -->
-                        <configuration>
-                            <embeddedTarget>/apps/\${appsFolderName}/install</embeddedTarget>
-                            <embeddeds>
-                                <embedded>
-                                    <groupId>\${project.groupId}</groupId>
-                                    <artifactId>core</artifactId>
-                                    <filter>true</filter>
-                                </embedded>
-                            </embeddeds>
-                        </configuration>
-                        <!-- @endForNotAll@ This is used for the Post Generation Handling.
Do not alter or remove -->
-                    </execution>
-                </executions>
             </plugin>
         </plugins>
     </build>
diff --git a/src/main/resources/archetype-resources/ui.apps/pom.xml b/src/main/resources/archetype-resources/ui.apps/pom.xml
index 6c9d02b..b786dd0 100644
--- a/src/main/resources/archetype-resources/ui.apps/pom.xml
+++ b/src/main/resources/archetype-resources/ui.apps/pom.xml
@@ -71,26 +71,17 @@
                 <artifactId>filevault-package-maven-plugin</artifactId>
                 <configuration>
                     <filterSource>\${basedir}/src/main/content/META-INF/vault/filter.xml</filterSource>
+                    <!-- @startForNotAll@ This is used for the Post Generation Handling.
Do not alter or remove -->
+                    <embeddedTarget>/apps/\${appsFolderName}/install</embeddedTarget>
+                    <embeddeds>
+                        <embedded>
+                            <groupId>\${project.groupId}</groupId>
+                            <artifactId>core</artifactId>
+                            <filter>true</filter>
+                        </embedded>
+                    </embeddeds>
+                    <!-- @endForNotAll@ This is used for the Post Generation Handling.
Do not alter or remove -->
                 </configuration>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>package</goal>
-                        </goals>
-                        <!-- @startForNotAll@ This is used for the Post Generation Handling.
Do not alter or remove -->
-                        <configuration>
-                            <embeddedTarget>/apps/\${appsFolderName}/install</embeddedTarget>
-                            <embeddeds>
-                                <embedded>
-                                    <groupId>\${project.groupId}</groupId>
-                                    <artifactId>core</artifactId>
-                                    <filter>true</filter>
-                                </embedded>
-                            </embeddeds>
-                        </configuration>
-                        <!-- @endForNotAll@ This is used for the Post Generation Handling.
Do not alter or remove -->
-                    </execution>
-                </executions>
             </plugin>
         </plugins>
     </build>
diff --git a/src/test/resources/projects/all/archetype.properties b/src/test/resources/projects/all/archetype.properties
index b408de5..31b7c30 100644
--- a/src/test/resources/projects/all/archetype.properties
+++ b/src/test/resources/projects/all/archetype.properties
@@ -20,15 +20,15 @@
 #
 # Test Project Configuration
 #
-package=org.apache.sling.all
+package=org.apache.sling.all.sep
 version=1.0.0-SNAPSHOT
-groupId=org.apache.sling.all.group
-artifactId=sample-test-all
-artifactName=Sample Test All
-packageGroup=org.apache.sling.all.install
-appsFolderName=testAppsAll
-contentFolderName=testContentAll
-slingModelSubPackage=testModelAll
+groupId=org.apache.sling.all.sep.group
+artifactId=sample-test-all-sep
+artifactName=Sample Test All Separated
+packageGroup=org.apache.sling.all.sep.install
+appsFolderName=testAppsAllSep
+contentFolderName=testContentAllSep
+slingModelSubPackage=testModelAllSep
 slingHostName=localhost
 slingPort=8080
 optionAll=y
diff --git a/src/test/resources/projects/allDeleted/archetype.properties b/src/test/resources/projects/allDeleted/archetype.properties
index 3005eaf..9b2e2e7 100644
--- a/src/test/resources/projects/allDeleted/archetype.properties
+++ b/src/test/resources/projects/allDeleted/archetype.properties
@@ -20,15 +20,15 @@
 #
 # Test Project Configuration
 #
-package=org.apache.sling.all
+package=org.apache.sling.all.del
 version=1.0.0-SNAPSHOT
-groupId=org.apache.sling.all.group
-artifactId=sample-test-all
-artifactName=Sample Test All
-packageGroup=org.apache.sling.all.install
-appsFolderName=testAppsAll
-contentFolderName=testContentAll
-slingModelSubPackage=testModelAll
+groupId=org.apache.sling.all.del.group
+artifactId=sample-test-all-del
+artifactName=Sample Test All Deleted
+packageGroup=org.apache.sling.all.del.install
+appsFolderName=testAppsAllDel
+contentFolderName=testContentAllDel
+slingModelSubPackage=testModelAllDel
 slingHostName=localhost
 slingPort=8080
 optionAll=y
diff --git a/src/test/resources/projects/allMerged/archetype.properties b/src/test/resources/projects/allMerged/archetype.properties
index f7ee987..3d0baaa 100644
--- a/src/test/resources/projects/allMerged/archetype.properties
+++ b/src/test/resources/projects/allMerged/archetype.properties
@@ -20,15 +20,15 @@
 #
 # Test Project Configuration
 #
-package=org.apache.sling.all
+package=org.apache.sling.all.mer
 version=1.0.0-SNAPSHOT
-groupId=org.apache.sling.all.group
-artifactId=sample-test-all
-artifactName=Sample Test All
-packageGroup=org.apache.sling.all.install
-appsFolderName=testAppsAll
-contentFolderName=testContentAll
-slingModelSubPackage=testModelAll
+groupId=org.apache.sling.all.mer.group
+artifactId=sample-test-all-mer
+artifactName=Sample Test All Merged
+packageGroup=org.apache.sling.all.mer.install
+appsFolderName=testAppsAllMer
+contentFolderName=testContentAllMer
+slingModelSubPackage=testModelAllMer
 slingHostName=localhost
 slingPort=8080
 optionAll=y
diff --git a/src/test/resources/projects/notAll/archetype.properties b/src/test/resources/projects/notAll/archetype.properties
index 3c15d8a..9c18001 100644
--- a/src/test/resources/projects/notAll/archetype.properties
+++ b/src/test/resources/projects/notAll/archetype.properties
@@ -20,15 +20,15 @@
 #
 # Test Project Configuration
 #
-package=org.apache.sling.ui
+package=org.apache.sling.ui.sep
 version=1.0.0-SNAPSHOT
-groupId=org.apache.sling.ui.group
-artifactId=sample-test-ui
-artifactName=Sample Test UI
-packageGroup=org.apache.sling.ui.install
-appsFolderName=testAppsUI
-contentFolderName=testContentUI
-slingModelSubPackage=testModelUI
+groupId=org.apache.sling.ui.sep.group
+artifactId=sample-test-ui-sep
+artifactName=Sample Test UI Separated
+packageGroup=org.apache.sling.ui.sep.install
+appsFolderName=testAppsUISep
+contentFolderName=testContentUISep
+slingModelSubPackage=testModelUISep
 slingHostName=localhost
 slingPort=8080
 optionAll=n
diff --git a/src/test/resources/projects/notAllDeleted/archetype.properties b/src/test/resources/projects/notAllDeleted/archetype.properties
index d814e01..84b0362 100644
--- a/src/test/resources/projects/notAllDeleted/archetype.properties
+++ b/src/test/resources/projects/notAllDeleted/archetype.properties
@@ -20,15 +20,15 @@
 #
 # Test Project Configuration
 #
-package=org.apache.sling.ui
+package=org.apache.sling.ui.del
 version=1.0.0-SNAPSHOT
-groupId=org.apache.sling.ui.group
-artifactId=sample-test-ui
-artifactName=Sample Test UI
-packageGroup=org.apache.sling.ui.install
-appsFolderName=testAppsUI
-contentFolderName=testContentUI
-slingModelSubPackage=testModelUI
+groupId=org.apache.sling.ui.del.group
+artifactId=sample-test-ui-del
+artifactName=Sample Test UI Deleted
+packageGroup=org.apache.sling.ui.del.install
+appsFolderName=testAppsUIDel
+contentFolderName=testContentUIDel
+slingModelSubPackage=testModelUIDel
 slingHostName=localhost
 slingPort=8080
 optionAll=n
diff --git a/src/test/resources/projects/notAllMerged/archetype.properties b/src/test/resources/projects/notAllMerged/archetype.properties
index 0b0d291..878671e 100644
--- a/src/test/resources/projects/notAllMerged/archetype.properties
+++ b/src/test/resources/projects/notAllMerged/archetype.properties
@@ -20,15 +20,15 @@
 #
 # Test Project Configuration
 #
-package=org.apache.sling.ui
+package=org.apache.sling.ui.mer
 version=1.0.0-SNAPSHOT
-groupId=org.apache.sling.ui.group
-artifactId=sample-test-ui
-artifactName=Sample Test UI
-packageGroup=org.apache.sling.ui.install
-appsFolderName=testAppsUI
-contentFolderName=testContentUI
-slingModelSubPackage=testModelUI
+groupId=org.apache.sling.ui.mer.group
+artifactId=sample-test-ui-mer
+artifactName=Sample Test UI Merged
+packageGroup=org.apache.sling.ui.mer.install
+appsFolderName=testAppsUIMer
+contentFolderName=testContentUIMer
+slingModelSubPackage=testModelUIMer
 slingHostName=localhost
 slingPort=8080
 optionAll=n


Mime
View raw message