0

I am using IntelliJ and Maven to build a Java Application. I have a bash script to execute the maven command mvn quicktag:quicktag when packaging the Application which updates the Version Details. I am trying to get my pom.xml to execute this bash script in the same folder as the pom.xml during the build. I have looked at this and this and finally tried here, but the script is not run and there is no error message.

I have tried most of the examples in the posts above, including the latest one from the third link.

Here is the relevant part of my pom:

<plugin>
  <groupId>net.mgorski.quicktag</groupId>
  <artifactId>quicktag</artifactId>
  <version>2.1.5</version>
  <executions>
    <execution>
      <phase>generate-sources</phase>
      <goals>
        <goal>quicktag</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <outputPackage>org.choughs.rws_monitor</outputPackage>
  </configuration>
</plugin>
<plugin>
  <artifactId>exec-maven-plugin</artifactId>
  <version>3.0.0</version>
  <groupId>org.codehaus.mojo</groupId>
  <executions>
    <execution>
      <id>Update Version using QuickTag</id>
      <phase>package</phase>
      <goals>
        <goal>exec</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <executable>${basedir}/updateVersion.sh</executable>
  </configuration>
</plugin>

and the oputput when I run mvn package from the command line:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO] 
[INFO] ----------------------< org.choughs:RWS_Monitor >-----------------------
[INFO] Building RWS Monitor 0.2.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ RWS_Monitor ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ RWS_Monitor ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ RWS_Monitor ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/francis/FG-Docs/IdeaProjects/RWS_Monitor/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ RWS_Monitor ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ RWS_Monitor ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.choughs.rws_monitor.RWS_MonitorTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.024 s - in org.choughs.rws_monitor.RWS_MonitorTest
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ RWS_Monitor ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.433 s
[INFO] Finished at: 2021-11-22T14:58:51Z
[INFO] ------------------------------------------------------------------------

Why is the bash script not executed during the build?

karel
  • 5,489
  • 46
  • 45
  • 50
themetman
  • 51
  • 6
  • 1
    It's also not running quicktag even though that should be happening in the `generate-sources` phase. Are your `` elements in `` rather than `pluginManagement`, and are you definitely executing the right pom? – Jelaby Nov 22 '21 at 16:01
  • `chmod +x` maybe? – MichalH Nov 22 '21 at 17:23
  • 1
    @Jelaby I had used a Maven Archetype when I created the project. All the Plugins were inside PluginManagement. I moved tham all outside PluginManagement and quicktag ran and my script, so all OK. A big THANK YOU! – themetman Nov 27 '21 at 11:35

0 Answers0