exec-maven-plugin icon indicating copy to clipboard operation
exec-maven-plugin copied to clipboard

The parameter 'executable' is missing or invalid

Open tsmock opened this issue 1 year ago • 1 comments

Source repo: https://github.com/tsmock/josm/tree/pom

Notes:

  • I'm attempting to convert an ant build.xml file to maven
  • I'd like to make it possible to run resource generation and misc scripts with mvn exec:{exec|java}@id
  • Two of the tasks are bound to phases and work properly as such. They do not work when called manually.
    • To check the output of those two tasks, look at target/classes/data/projection/custom-epsg -- it should not be empty (and is not empty on mvn clean test-compile or mvn clean package)
    • These tasks are bound to phases that run after compile but before test-compile
  • I am probably overlooking something. I'm also probably doing something stupid in the pom files.

Steps to reproduce in cloned repo:

$ git clone https://github.com/tsmock/josm.git --branch pom
$ mvn clean test-compile
$ head -n3 target/classes/data/projection/custom-epsg
$ mvn clean compile exec:exec@epsg-touch exec:exec@epsg
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.2.0:exec (epsg-touch) on project josm-parent: The parameter 'executable' is missing or invalid -> [Help 1]
$ head -n3 target/classes/data/projection/custom-epsg

What I've looked at:

  • https://stackoverflow.com/questions/8252107/is-it-possible-to-execute-two-different-maven-exec-maven-plugin-in-a-single-pom: I think I'm doing the right thing[1]
  • https://stackoverflow.com/questions/2192660/maven-maven-exec-plugin-multiple-execution-configurations: I think I'm doing the right thing[1]
  • #22 : I think I'm doing the right thing[1]
  • #287 : Not helpful.
[1] POM XML
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId> <!-- version used is 3.2.0, declared in parent -->
        <executions>
          <!-- mvn test-compile && mvn exec:java@update-proj-reference-files -->
          <execution>
            <id>update-proj-reference-files</id>
            <configuration>
              <classpathScope>test</classpathScope>
              <mainClass>org.openstreetmap.josm.data.projection.ProjectionRefTest</mainClass>
            </configuration>
            <goals>
              <goal>java</goal>
            </goals>
          </execution>
          <!-- mvn test-compile && mvn exec:java@update-proj-regression-files -->
          <execution>
            <id>update-proj-regression-files</id>
            <configuration>
              <classpathScope>test</classpathScope>
              <mainClass>org.openstreetmap.josm.data.projection.ProjectionRegressionTest</mainClass>
            </configuration>
            <goals>
              <goal>java</goal>
            </goals>
          </execution>
          <!-- mvn compile && mvn exec:java@SyncEditorLayerIndex -->
          <execution>
            <id>SyncEditorLayerIndex</id>
            <configuration>
              <executable>java</executable>
              <arguments>
                <argument>-Djava.awt.headless=true</argument>
                <argument>-classpath</argument>
                <classpath/> <!-- Generates the actual classpath using all project dependencies -->
                <argument>${scripts.src.dir}/SyncEditorLayerIndex.java</argument>
                <argument>${basedir}</argument>
              </arguments>
              <!-- We need commons-lang3, which isn't needed elsewhere in core (besides a test or two) -->
              <classpathScope>test</classpathScope>
            </configuration>
            <goals>
              <goal>exec</goal>
            </goals>
          </execution>
          <!-- Note that the epsg-touch/epsg executions are NOT duplicates - the first epsg makes an empty file for the
               next run, which makes a non-empty custom-epsg file -->
          <execution>
            <id>epsg-touch</id>
            <configuration>
              <executable>java</executable>
              <arguments>
                <argument>-Djava.awt.headless=true</argument>
                <argument>-classpath</argument>
                <classpath/> <!-- Generates the actual classpath using all project dependencies -->
                <argument>${basedir}/scripts/BuildProjectionDefinitions.java</argument>
                <argument>${basedir}</argument>
              </arguments>
            </configuration>
            <phase>process-classes</phase>
            <goals>
              <goal>exec</goal>
            </goals>
          </execution>
          <execution>
            <id>epsg</id>
            <configuration>
              <executable>java</executable>
              <arguments>
                <argument>-Djava.awt.headless=true</argument>
                <argument>-classpath</argument>
                <classpath/> <!-- Generates the actual classpath using all project dependencies -->
                <argument>${basedir}/scripts/BuildProjectionDefinitions.java</argument>
                <argument>${basedir}</argument>
              </arguments>
            </configuration>
            <phase>generate-test-resources</phase>
            <goals>
              <goal>exec</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

tsmock avatar May 16 '24 18:05 tsmock

can you execute your example with:

mvn -X clean compile exec:exec@epsg-touch exec:exec@epsg

and provide output like:

[DEBUG] Configuring mojo execution 'org.codehaus.mojo:exec-maven-plugin:3.2.0:exec:epsg-touch' with basic configurator -->
...
[DEBUG]   (f) classpathScope = runtime
[DEBUG]   (f) executable = java
[DEBUG]   (f) forceJava = false
...

slawekjaranowski avatar Aug 06 '24 20:08 slawekjaranowski