0

I have a multi module maven project where I want a plugin to run a bash script while building one of the child projects, in validation phase. I have defined a exec-maven-plugin in the parent project with the path of the script file and passing the phase as a parameter from the child project. But it looks like the control doesn't reach until

          parent project
                       |_ childProject 1(project where the script file has to run before compilation)
                       |
                       |_ childProject 2
                       |
                       |_ childProject 3


 parent pom:
        <profiles>    
          <profile>
             <id>my-profile</id>
              <build>
               <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>my-execution</id>
                            <phase>${phase.prop}</phase>
                            <configuration>
                                <executable>./file.cmd</executable>
                            </configuration>
                            <goals>
                                <goal>exec</goal>
                            </goals>                        
                          </execution>
                         </executions>
                       </plugin>
                      </plugins>
                     </build>
                    </profile>
                   </profiles>

 ChildPom1:

    <properties>
         <phase.prop>validate</phase.prop>
    </properties>
user944849
  • 14,524
  • 2
  • 61
  • 83
Teja
  • 25
  • 5
  • Why do you need to run a bash script within a Maven build? What is the purpose ? What kind of problem are you trying to solve? – khmarbaise May 17 '19 at 06:44

1 Answers1

0

Unfortunately, it is not possible to do what you're attempting. For profiles, Maven only interpolates properties provided on the command line. This answer goes into more detail.

user944849
  • 14,524
  • 2
  • 61
  • 83