Replacing exec-maven-plugin with maven-antrun-plugin 70/119570/1
authorSingal, Kapil (ks220y) <ks220y@att.com>
Mon, 22 Mar 2021 03:45:12 +0000 (23:45 -0400)
committerSingal, Kapil (ks220y) <ks220y@att.com>
Mon, 22 Mar 2021 03:45:12 +0000 (23:45 -0400)
With changes users with Windows environment can build module

Note: Couldn't find alternate for running a bash script, so moved same into a profile which only gets activated only if OS family is UNIX

Issue-ID: CCSDK-3226
Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com>
Change-Id: Idc7c0874525502553b6290dc151a2db84447fd68

dgbuilder-docker/pom.xml

index a857723..d5f2df4 100644 (file)
                     </execution>
                 </executions>
             </plugin>
-
             <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>exec-maven-plugin</artifactId>
-                <version>1.5.0</version>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <version>1.8</version>
                 <executions>
                     <execution>
-                        <id>Make-stage-dir</id>
+                        <id>make-stage-dir</id>
                         <phase>generate-sources</phase>
-                        <goals>
-                            <goal>exec</goal>
-                        </goals>
                         <configuration>
-                            <executable>/bin/mkdir</executable>
-                            <arguments>
-                                <argument>-p</argument>
-                                <argument>${basedir}/target/docker-stage/opt/onap/ccsdk</argument>
-                            </arguments>
+                            <target>
+                                <mkdir dir="${basedir}/target/docker-stage/opt/onap/ccsdk"/>
+                            </target>
                         </configuration>
-                    </execution>
-                    <execution>
-                        <id>Unzip dgbuilder</id>
-                        <phase>generate-sources</phase>
                         <goals>
-                            <goal>exec</goal>
+                            <goal>run</goal>
                         </goals>
-                        <configuration>
-                            <executable>/usr/bin/unzip</executable>
-                            <arguments>
-                                <argument>-d</argument>
-                                <argument>${basedir}/target/docker-stage/opt/onap/ccsdk</argument>
-                                <argument>../dgbuilder/target/*.zip</argument>
-                            </arguments>
-                        </configuration>
                     </execution>
                     <execution>
-                        <id>Copy dgbuilder</id>
+                        <id>unzip-dgbuilder</id>
                         <phase>generate-sources</phase>
-                        <goals>
-                            <goal>exec</goal>
-                        </goals>
                         <configuration>
-                            <executable>/bin/cp</executable>
-                            <arguments>
-                                <argument>-r</argument>
-                                <argument>../dgbuilder</argument>
-                                <argument>${basedir}/target/docker-stage/opt/onap/ccsdk</argument>
-                            </arguments>
+                            <target>
+                                <unzip dest="${basedir}/target/docker-stage/opt/onap/ccsdk">
+                                    <fileset dir="${basedir}/../dgbuilder/target/">
+                                        <include name="**/*.zip"/>
+                                    </fileset>
+                                </unzip>
+                            </target>
                         </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
                     </execution>
-
                     <execution>
-                        <id>dgbuilder createReleaseDir</id>
+                        <id>copy-dgbuilder</id>
                         <phase>generate-sources</phase>
-                        <goals>
-                            <goal>exec</goal>
-                        </goals>
                         <configuration>
-                            <executable>/bin/bash</executable>
-                            <arguments>
-                                <argument>${basedir}/target/docker-stage/opt/onap/ccsdk/dgbuilder/createReleaseDir.sh</argument>
-                                <argument>1702</argument>
-                                <argument>dguser</argument>
-                                <argument>change_email_id@dgbuilder.com</argument>
-                            </arguments>
+                            <target>
+                                <copy todir="${basedir}/target/docker-stage/opt/onap/ccsdk/dgbuilder">
+                                    <fileset dir="${basedir}/../dgbuilder" excludes="target/**"/>
+                                </copy>
+                            </target>
                         </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
                     </execution>
-
                     <execution>
                         <id>change shell permissions</id>
                         <phase>process-sources</phase>
-                        <goals>
-                            <goal>exec</goal>
-                        </goals>
                         <configuration>
-                            <executable>/usr/bin/find</executable>
-                            <arguments>
-                                <argument>${basedir}/target/docker-stage/opt/onap/ccsdk</argument>
-                                <argument>-name</argument>
-                                <argument>*.sh</argument>
-                                <argument>-exec</argument>
-                                <argument>chmod</argument>
-                                <argument>+x</argument>
-                                <argument>{}</argument>
-                                <argument>;</argument>
-                            </arguments>
+                            <target>
+                                <chmod dir="${basedir}/target/docker-stage/opt/onap/ccsdk" perm="+x" includes="**/*.sh"/>
+                            </target>
                         </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
                     </execution>
                 </executions>
             </plugin>
     </build>
 
     <profiles>
+        <profile>
+            <id>unix</id>
+            <activation>
+                <os>
+                    <family>unix</family>
+                </os>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <version>1.5.0</version>
+                        <executions>
+                            <!-- TODO: Need to see alternate for below, so that it can execute on Windows Environment -->
+                            <execution>
+                                <id>dgbuilder-createReleaseDir</id>
+                                <phase>generate-sources</phase>
+                                <goals>
+                                    <goal>exec</goal>
+                                </goals>
+                                <configuration>
+                                    <executable>/bin/bash</executable>
+                                    <arguments>
+                                        <argument>${basedir}/target/docker-stage/opt/onap/ccsdk/dgbuilder/createReleaseDir.sh</argument>
+                                        <argument>1702</argument>
+                                        <argument>dguser</argument>
+                                        <argument>change_email_id@dgbuilder.com</argument>
+                                    </arguments>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
         <profile>
             <id>docker</id>
             <build>