You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by gk...@apache.org on 2021/07/13 15:14:16 UTC

[turbine-archetypes] 01/05: integrate merged and modified docker branch

This is an automated email from the ASF dual-hosted git repository.

gk pushed a commit to branch docker5x
in repository https://gitbox.apache.org/repos/asf/turbine-archetypes.git

commit 018f6ebaadf6aa6d4287bacdb3be3f4f15ceda18
Author: Georg Kallidis <gk...@apache.org>
AuthorDate: Thu Jul 8 14:29:10 2021 +0200

    integrate merged and modified docker branch
---
 pom.xml                                            | 52 ++++++++++++++++++++-
 src/changes/changes.xml                            |  5 ++
 .../META-INF/maven/archetype-metadata.xml          |  9 ++++
 src/main/resources/archetype-resources/pom.xml     | 53 +++++++++++++++++++---
 .../src/main/webapp/WEB-INF/jetty-env.xml          |  2 +-
 .../resources/projects/first/archetype.properties  |  3 +-
 6 files changed, 115 insertions(+), 9 deletions(-)

diff --git a/pom.xml b/pom.xml
index e8938b3..876deb5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
   <packaging>maven-archetype</packaging>
 
   <name>Archetype - Turbine 5.1 WebApp</name>
-  <description>This archetype sets up a web application project based on Apache Turbine 5.1</description>
+  <description>This archetype sets up a web application project based on Apache Turbine 5.x and Torque 5.x</description>
   <url>https://turbine.apache.org</url>
 
   <inceptionYear>2011</inceptionYear>
@@ -43,6 +43,12 @@
     <tag>HEAD</tag>
   </scm>
   
+   <properties>
+	<turbine_database_url>jdbc:mysql://localhost:3306/</turbine_database_url>
+    <docker>false</docker>
+    <app_volume_local_repo>not_used</app_volume_local_repo>
+  </properties>
+  
   <build>
     <extensions>
       <extension>
@@ -64,6 +70,50 @@
         </plugin>
       </plugins>
     </pluginManagement>
+    
+   <plugins>
+        <!-- filtering for docker -->
+        <plugin>
+            <artifactId>maven-resources-plugin</artifactId>
+            <version>3.1.0</version>
+            <executions>
+              <execution>
+                <id>copy-resources</id>
+                <phase>validate</phase>
+                <goals>
+                  <goal>copy-resources</goal>
+                </goals>
+                <configuration>
+                  <outputDirectory>${basedir}/target/test-classes</outputDirectory>
+                  <resources>          
+                    <resource>
+                      <directory>src/test/resources</directory>
+                      <filtering>true</filtering>
+                    </resource>
+                  </resources>              
+                </configuration>            
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
   </build>
+  
+    <profiles>
+    <!-- to test in integration-test -->
+        <profile>
+            <id>docker</id>
+            <activation>
+              <property>
+                <name>docker</name>
+              </property>
+             </activation>
+             <properties>
+                <turbine_database_url>jdbc:mysql://db:3306/</turbine_database_url>
+                <!-- to provide your locale maven repo, required if you need local snapshot builds -->
+                <app_volume_local_repo>${settings.localRepository}</app_volume_local_repo>
+                <docker>true</docker>
+            </properties>
+        </profile>
+    </profiles>
 
 </project>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 70d544e..c5ccaff 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -24,6 +24,11 @@
   </properties>
 
   <body>
+    <release version="2.0.0-SNAPSHOT" date="in Gitbox">
+       <action type="update" dev="gk">
+        integrate docker branch (optional profile docker)
+      </action>
+    </release>
 	<release version="1.0.3" date="in Gitbox">
 	  <action type="update" dev="jp">
          Update to from lang to lang3
diff --git a/src/main/resources/META-INF/maven/archetype-metadata.xml b/src/main/resources/META-INF/maven/archetype-metadata.xml
index 4dfe69c..b46d110 100644
--- a/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -54,6 +54,9 @@
     <requiredProperty key="turbine_database_password">
       <defaultValue>db_password</defaultValue>
     </requiredProperty>
+     <requiredProperty key="app_volume_local_repo">
+        <defaultValue>${settings.localRepository}</defaultValue>
+     </requiredProperty>
   </requiredProperties>
   <fileSets>
     <fileSet filtered="true" packaged="true">
@@ -134,5 +137,11 @@
           <include>**/*</include>
         </includes>
     </fileSet>
+    <fileSet filtered="true" packaged="false">
+        <directory>docker-resources</directory>
+        <includes>
+          <include>**/*</include>
+        </includes>
+     </fileSet>
   </fileSets>
 </archetype-descriptor>
diff --git a/src/main/resources/archetype-resources/pom.xml b/src/main/resources/archetype-resources/pom.xml
index 557bb25..4e22b7c 100644
--- a/src/main/resources/archetype-resources/pom.xml
+++ b/src/main/resources/archetype-resources/pom.xml
@@ -186,8 +186,7 @@ under the License.
 
             <!--  The serverTimezone parameter is required for MySQL.
             	You may need to remove it for other databases -->
-            <url>${turbine_database_url}${turbine_database_name}?serverTimezone=${turbine_database_timezone}&amp;useSSL=false&amp;verifyServerCertificate=false&amp;requireSSL=false</url>
-
+            <url>#var("turbine_database_url")${turbine_database_name}?serverTimezone=${turbine_database_timezone}&amp;useSSL=false&amp;verifyServerCertificate=false&amp;requireSSL=false</url>
             <username>${turbine_database_user}</username>
             <password>${turbine_database_password}</password>
             <onError>continue</onError>
@@ -212,6 +211,7 @@ under the License.
                   <goal>execute</goal>
                 </goals>
                 <configuration>
+                  <skip>${docker}</skip>
                   <orderFile>ascending</orderFile>
                   <fileset>
                     <basedir>#var("project.build.directory")/generated-sql/torque/mysql</basedir>
@@ -229,6 +229,7 @@ under the License.
                 <goal>execute</goal>
               </goals>
               <configuration>
+                <skip>${docker}</skip>
                 <orderFile>ascending</orderFile>
                 <srcFiles>
                   <srcFile>#var("project.basedir")/docs/sample-mysql-data/_application-data.sql</srcFile>
@@ -333,11 +334,10 @@ under the License.
        </dependency>
        <!-- include some optional dependencies required in example componentConfiguration.xml -->
 
-      <!-- cache 1.1.1-SNAPSHOT still not building properly -->
       <dependency>
         <groupId>org.apache.fulcrum</groupId>
         <artifactId>fulcrum-cache</artifactId>
-        <version>1.1.0</version>
+        <version>#var("fulcrum.cache")</version>
       </dependency>
       <dependency>
         <groupId>org.apache.fulcrum</groupId>
@@ -368,7 +368,7 @@ under the License.
       <dependency>
         <groupId>com.fasterxml.jackson.datatype</groupId>
         <artifactId>jackson-datatype-json-org</artifactId>
-        <!-- version>$dollar{jackson.version}</version-->
+        <!-- version>${jackson.version}</version-->
         <!--  https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.11.3 -->
         <version>2.11.3</version>
       </dependency>
@@ -406,13 +406,20 @@ under the License.
         <log4j2.version>2.14.1</log4j2.version>
         <mysql.version>8.0.25</mysql.version>
         <torque.version>5.0</torque.version>
-        <fulcrum.json>2.0.0</fulcrum.json>
+        <fulcrum.json>2.0.1</fulcrum.json>
         <fulcrum.intake>2.0.0</fulcrum.intake>
         <fulcrum.security>2.0.0</fulcrum.security>
         <fulcrum.yaafi>1.0.8</fulcrum.yaafi>
         <fulcrum.testcontainer>1.0.9</fulcrum.testcontainer>
+        <!--torque.version>5.1-SNAPSHOT</torque.version>
+        <fulcrum.intake>2.0.1-SNAPSHOT</fulcrum.intake>
+        <fulcrum.security>2.0.0-SNAPSHOT</fulcrum.security-->
+
         <turbine.core>5.1-SNAPSHOT</turbine.core>
         <skipTests>true</skipTests>
+        <docker>false</docker>
+        <turbine_database_url>${turbine_database_url}</turbine_database_url>
+        <app_volume_local_repo>NOT_USED</app_volume_local_repo>
     </properties>
     
     <profiles>
@@ -450,6 +457,40 @@ under the License.
                 </plugins>
             </build>
         </profile>
+        <profile>
+            <id>docker</id>
+            <activation>
+                <activeByDefault>${docker}</activeByDefault>
+            </activation>
+             <build>
+                <plugins>
+                        <plugin>
+                       <groupId>org.codehaus.mojo</groupId>
+                       <artifactId>sql-maven-plugin</artifactId>
+                       <executions>
+                            <execution>
+                                <id>create-db</id>
+                                <configuration>
+                                    <skip>true</skip>
+                                </configuration>
+                            </execution>
+                            <execution>
+                               <id>create-data</id>
+                                <configuration>
+                                    <skip>true</skip>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                 </plugins>
+              </build>
+            <properties>
+                <turbine_database_url>jdbc:mysql://db:3306/</turbine_database_url>
+                <!-- to provide e.g. local snapshot builds -->
+                <app_volume_local_repo>#var("settings.localRepository")</app_volume_local_repo>
+                <docker>true</docker>
+            </properties>
+        </profile>
     </profiles>
     
 </project>
diff --git a/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jetty-env.xml b/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jetty-env.xml
index 83a724f..6512119 100644
--- a/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jetty-env.xml
+++ b/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/jetty-env.xml
@@ -8,7 +8,7 @@
              <Set name="url">${turbine_database_url}${turbine_database_name}</Set>
             <Set name="username">${turbine_database_user}</Set>
             <Set name="password">${turbine_database_password}</Set>
-            <Set name="connectionProperties">serverTimezone=${turbine_database_timezone};useUnicode=true;characterEncoding=utf8;</Set>
+            <Set name="connectionProperties">serverTimezone=${turbine_database_timezone};useUnicode=true;characterEncoding=utf8;useSSL=false;allowPublicKeyRetrieval=true</Set>
             <Set name="validationQuery">SELECT 1</Set>          
         </New>
     </Arg>
diff --git a/src/test/resources/projects/first/archetype.properties b/src/test/resources/projects/first/archetype.properties
index 1155d78..1d7a742 100644
--- a/src/test/resources/projects/first/archetype.properties
+++ b/src/test/resources/projects/first/archetype.properties
@@ -9,6 +9,7 @@ turbine_database_adapter=auto
 turbine_database_jndipath=jdbc/turbine
 turbine_database_driver=com.mysql.cj.jdbc.Driver
 turbine_database_timezone=UTC
-turbine_database_url=jdbc:mysql://localhost:3306/
+turbine_database_url=${turbine_database_url}
 turbine_database_user=db_user
 turbine_database_password=db_password
+app_volume_local_repo=${app_volume_local_repo}