1

I am trying to run a JavaFX application under Maven. When I run the program it shows some error.

Error: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project Calculator: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java are missing or invalid -> [Help 1]

At which part i should make the change in my pom.xml file.

Using netbeans 11.0 
JDK 12 

I tried to see some available solutions on stackoverflow itself.

This is my Pom.xml file

<project xmlns="http://maven.apache.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>
    <groupId>gproject</groupId>
    <artifactId>Calculator</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>Calculator</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <mainClass>gproject.calculator.MainApp</mainClass>
        <maven.compiler.source>12</maven.compiler.source>
        <maven.compiler.target>12</maven.compiler.target>
    </properties>

    <organization>
        <!-- Used as the 'Vendor' for JNLP generation -->
        <name>Your Organisation</name>
    </organization>
    <dependencies>
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-controls</artifactId>
      <version>12.0.1</version>
    </dependency>
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-fxml</artifactId>
      <version>12.0.1</version>
    </dependency>
  </dependencies>


  <
build>

    <plugins>
      <plugin>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-maven-plugin</artifactId>
        <version>0.0.2</version>
        <configuration>
          <mainClass>gproject.calculator.MainApp</mainClass>
        </configuration>
      </plugin>
    </plugins>

<
/build>

<
/project>

------------------------------------------------------------------------ BUILD FAILURE ------------------------------------------------------------------------ Total time: 4.614 s Finished at: 2019-05-27T00:49:24+05:30 Final Memory: 14M/40M

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project Calculator: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java are missing or invalid -> [Help 1] ----------------------------------------------------------------------------- To see the full stack trace of the errors, re-run Maven with the -e switch. Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles: [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginParameterException**

Vega
  • 27,856
  • 27
  • 95
  • 103

1 Answers1

0

I added some line of code under tag Plugins in my pom.xml file. Also, I referred to a youtube video.

Link: https://www.youtube.com/watch?v=RCdBmPfzeyM Make sure to watch the full video.

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version>
        <configuration>
            <release>11</release>
        </configuration>
      </plugin>  

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.6.0</version>
        <executions>
            <execution>
                <goals>
                    <goal>java</goal>
                </goals>
            </execution>

        </executions>
        <configuration>
          <mainClass>gproject.calculator.MainApp</mainClass>

        </configuration>
      </plugin>
    </plugins>
</build>