如何在Intellij中构建Multi-Maven JavaFX项目

时间:2018-12-21 13:24:25

标签: java maven intellij-13

我正在尝试构建一个多模块Maven应用程序,我想将每个模块都设为JavaFx模块。 但是,当我尝试运行应用程序时,总是出现以下错误:

“无法在项目父对象上执行目标org.codehaus.mojo:exec-maven-plugin:1.6.0:java(default-cli):目标org.codehaus.mojo:exec-maven的参数'mainClass' -plugin:1.6.0:java丢失或无效”

父POM.xml

<?xml version="1.0" encoding="UTF-8"?>
<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>com.parent</groupId>
    <artifactId>parent</artifactId>
    <version>1.0-SNAPSHOT</version>

    <modules>
        <module>hellofx</module>
    </modules>
    <packaging>pom</packaging>
    <name>the-parent</name>
</project>

父模块

<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
    <groupId>com.parent</groupId>
    <artifactId>parent</artifactId>
    <version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>



<artifactId>hellofx</artifactId>
<packaging>jar</packaging>

<name>hellofx</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <mainClass>org.openjfx.MainApp</mainClass>
</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>11</version>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-fxml</artifactId>
        <version>11</version>
    </dependency>
</dependencies>

<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>org.openjfx.MainApp</mainClass>
            </configuration>
        </plugin>

    </plugins>
</build>

</project>

项目结构:

  • 项目
    • .idea
    • hellofx
      • .idea
      • src
      • pom.xml
    • src
    • pom.xml

1 个答案:

答案 0 :(得分:0)

使用CMD窗口指向项目的根目录,然后使用以下命令:

JSON.stringify({$and:[{"createdOn":{$lte:"1712086400000"}},{"country": "India"},{"Type": "App"}]})

仅供参考:Check the Parallel builds in Maven