Fix schema-service docker build 63/141063/3
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Mon, 2 Jun 2025 11:37:57 +0000 (13:37 +0200)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Mon, 2 Jun 2025 11:43:06 +0000 (13:43 +0200)
- replace gmaven plugin with build-helper-maven-plugin
  to retrieve major and minor project version during
  docker build

Issue-ID: AAI-4167
Change-Id: If31ea8f5d57fcf3744a364f6e369f59311c2d332
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
aai-schema-service/pom.xml

index 7bc89dd..cc7704e 100644 (file)
@@ -77,7 +77,6 @@
         <schema.uri.base.path>/aai/schema-service</schema.uri.base.path>
         <!-- End of Default ONAP Schema Properties -->
 
-        <!-- Setting some default value to not complain by editor but it will be overridden by gmaven plugin -->
     </properties>
     <profiles>
         <!-- Docker profile to be used for building docker image and pushing to nexus -->
             <build>
                 <plugins>
                     <plugin>
-                        <groupId>org.codehaus.groovy.maven</groupId>
-                        <artifactId>gmaven-plugin</artifactId>
+                        <!-- This plugin provides the parsedVersion that is used
+                         for the docker-build-plugin -->
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>build-helper-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>parse-version</id>
+                                <phase>pre-clean</phase>
+                                <goals>
+                                    <goal>parse-version</goal>
+                                </goals>
+                            </execution>
+                        </executions>
                     </plugin>
                     <plugin>
                         <groupId>io.fabric8</groupId>
                                         <filter>@</filter>
                                         <tags>
                                             <tag>latest</tag>
-                                            <tag>${project.docker.latesttag.version}</tag>
-                                            <tag>${project.major.version}.${project.minor.version}-STAGING-${maven.build.timestamp}</tag>
+                                            <tag>
+                                                ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-latest
+                                            </tag>
+                                            <tag>
+                                                ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}-STAGING-${maven.build.timestamp}
+                                            </tag>
                                         </tags>
                                         <cleanup>try</cleanup>
                                         <dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
         <pluginManagement>
             <plugins>
                 <plugin>
-                    <groupId>org.codehaus.groovy.maven</groupId>
-                    <artifactId>gmaven-plugin</artifactId>
-                    <version>1.0</version>
-                    <executions>
-                        <execution>
-                            <phase>validate</phase>
-                            <goals>
-                                <goal>execute</goal>
-                            </goals>
-                            <configuration>
-                                <source>
-                                    println project.properties['aai.project.version'];
-                                    def versionArray;
-                                    if (project.properties['aai.project.version'] != null) {
-                                        versionArray = project.properties['aai.project.version'].split('\\.');
-                                    }
-
-                                    project.properties["project.major.version"] = versionArray[0];
-                                    project.properties["project.minor.version"] = versionArray[1];
-                                    project.properties['project.docker.latesttag.version'] = versionArray[0] + '.' + versionArray[1] + '-STAGING-latest';
-                                    println 'New Tag for docker:' + project.properties['project.docker.latesttag.version'];
-                                </source>
-                            </configuration>
-                        </execution>
-                    </executions>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>build-helper-maven-plugin</artifactId>
+                    <version>3.6.0</version>
                 </plugin>
             </plugins>
         </pluginManagement>
                     </filesets>
                 </configuration>
             </plugin>
-            <plugin>
-                <groupId>org.codehaus.groovy.maven</groupId>
-                <artifactId>gmaven-plugin</artifactId>
-            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-dependency-plugin</artifactId>