0

I've configured exec-mavein-plugin in my module's pom.xml file, but something isn't quite right.

I can invoke the goal directory mvn exec:exec and it works correctly and creates an executable file.

I believe it is configured correctly to be attached to the package phase. But when the package phase is invoked the output file is not created. I'm hoping a small tweak to the configuration will fix it.

Here is the pom.xml file.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.exache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    ...
  </parent>

  <artifactId>rmqcm</artifactId>
  <packaging>jar</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>rmqcm</name>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>exec-maven-plugin</artifactId>
      <version>3.0.0</version>
      <type>maven-plugin</type>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        ...
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>3.0.0</version>
          <executions>
            <execution>
              <id>Create Executable</id>
              <phase>package</phase>
              <goals>
                <goal>exec</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <executable>${project.basedir}/scripts/make_rmqcm.bat</executable>
            <arguments>
              <argument>${project.basedir}\scripts\executable_java_stub.sh</argument>
              <argument>${project.build.directory}\${project.build.finalName}.jar</argument>
              <argument>${project.build.directory}\${project.name}</argument>
            </arguments>
          </configuration>
        </plugin>        
      </plugins>
    </pluginManagement>
  </build>
</project>

I appreciate your help.

Russ Petersen

Russ Petersen
  • 765
  • 1
  • 9
  • 29
  • Is there a specific reason you defined the plugin in the `pluginManagement` section instead of in the `plugins` section ? Normally, the plugins in the `pluginManagement` section are inherited to "children" of that module, but not executed on the module itself. – Turing85 Nov 16 '21 at 21:22
  • The only reason I did there (or the fact I even have a pluginManagement sections) is because of my ignorance (I'm very new to it all). I'll give that a try and report back. Thanks Turing85. – Russ Petersen Nov 16 '21 at 21:47
  • Ding, ding, ding we have a winner. I removed the `pluginManagement` tags and the plugins that were not needed by this sub-module and *voila*, it works. Comes down to my lack of experience. Thanks again! – Russ Petersen Nov 16 '21 at 21:55

0 Answers0