JavaFX2.0 + Maven + Netbeans + mojo

时间:2013-10-03 17:22:22

标签: java maven compilation javafx-2 netbeans-7

我正在使用netbeans 7.4和maven创建一个javaFX2.0项目。但我对maven并不是很好。因此,当我运行我的项目时,我有一个关于mojo的错误。我不知道如何解决这个问题。

我的pom.xml

<?xml version="1.0" encoding="UTF-8"?>

http://maven.apache.org/xsd/maven-4.0.0.xsd“&GT;     4.0.0

<groupId>com.drive</groupId>
<artifactId>Superviseur</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Superviseur</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <mainClass>com.drive.superviseur.MainApp</mainClass>
</properties>

<organization>
    <!-- Used as the 'Vendor' for JNLP generation -->
    <name>Your Organisation</name>
</organization>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <id>unpack-dependencies</id>
                    <phase>package</phase>
                    <goals>
                        <goal>unpack-dependencies</goal>
                    </goals>
                    <configuration>
                        <excludeScope>system</excludeScope>
                        <excludeGroupIds>junit,org.mockito,org.hamcrest</excludeGroupIds>
                        <outputDirectory>${project.build.directory}/classes</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <executions>
                <execution>
                    <id>unpack-dependencies</id>

                    <phase>package</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                    <configuration>
                        <executable>${java.home}/../bin/javafxpackager</executable>
                        <arguments>
                            <argument>-createjar</argument>
                            <argument>-nocss2bin</argument>
                            <argument>-appclass</argument>
                            <argument>${mainClass}</argument>
                            <argument>-srcdir</argument>
                            <argument>${project.build.directory}/classes</argument>
                            <argument>-outdir</argument>
                            <argument>${project.build.directory}</argument>
                            <argument>-outfile</argument>
                            <argument>${project.build.finalName}.jar</argument>
                        </arguments>
                    </configuration>
                </execution>
            </executions>  
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
                <compilerArguments>
                    <bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
                </compilerArguments>
            </configuration>
        </plugin>
    </plugins>
</build>

和错误:

  

无法在项目Superviseur上执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:exec(default-cli):命令执行失败。退出并出现错误:1(退出值:1) - &gt; [帮助1]

要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven。 使用-X开关重新运行Maven以启用完整的调试日志记录。

有关错误和可能的解决方案的更多信息,请阅读以下文章: [帮助1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

任何想法? THX

1 个答案:

答案 0 :(得分:0)

我已经修复了我的错误。这真的很容易。我只是将我的项目放在Netbeans的发布配置文件中,它运行正常。