Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在NetBeans中评测JavaFXMaven项目_Maven_Javafx_Netbeans_Profiling_Netbeans 8 - Fatal编程技术网

如何在NetBeans中评测JavaFXMaven项目

如何在NetBeans中评测JavaFXMaven项目,maven,javafx,netbeans,profiling,netbeans-8,Maven,Javafx,Netbeans,Profiling,Netbeans 8,当我尝试在Netbeans 8.2中评测JavaFX项目时,我得到以下生成错误: cd C:\Users\David\Documents\NetBeansProjects\FxClock; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.8.0_101" cmd /c "\"\"C:\\Program Files\\NetBeans 8.2\\java\\maven\\bin\\mvn.bat\" -Dexec.args.merged=true -Dexec.a

当我尝试在Netbeans 8.2中评测JavaFX项目时,我得到以下生成错误:

cd C:\Users\David\Documents\NetBeansProjects\FxClock; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.8.0_101" cmd /c "\"\"C:\\Program Files\\NetBeans 8.2\\java\\maven\\bin\\mvn.bat\" -Dexec.args.merged=true -Dexec.args=\"-agentpath:\\\"C:/Program Files/NetBeans 8.2/profiler/lib/deployed/jdk16/windows-amd64/profilerinterface.dll\\\"=\\\"C:\\Program Files\\NetBeans 8.2\\profiler\\lib\\\",5140,10 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:\\Users\\David\\AppData\\Local\\NetBeans\\Cache\\8.2\\mavencachedirs\\521057086\\org-netbeans-modules-profiler  -createjar -nocss2bin -appclass com.upce.fxclock.MainApp -srcdir C:\\Users\\David\\Documents\\NetBeansProjects\\FxClock\\target/classes -outdir C:\\Users\\David\\Documents\\NetBeansProjects\\FxClock\\target -outfile FxClock-1.0-SNAPSHOT.jar\" -Dexec.executable=\"C:\\Program Files\\Java\\jdk1.8.0_101\\bin\\java.exe\" -Dmaven.ext.class.path=\"C:\\Program Files\\NetBeans 8.2\\java\\maven-nblib\\netbeans-eventspy.jar\" -Dfile.encoding=UTF-8 process-classes org.codehaus.mojo:exec-maven-plugin:1.2.1:exec\""

Default 'profile' action exec.args merged with maven-exec-plugin arguments declared in pom.xml.
Scanning for projects...

------------------------------------------------------------------------
Building FxClock 1.0-SNAPSHOT
------------------------------------------------------------------------

--- maven-resources-plugin:2.5:resources (default-resources) @ FxClock ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
Copying 5 resources

--- maven-compiler-plugin:3.1:compile (default-compile) @ FxClock ---
Nothing to compile - all classes are up to date

--- exec-maven-plugin:1.2.1:exec (default-cli) @ FxClock ---
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Unrecognized option: -createjar
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 1.158s
Finished at: Sun May 14 23:35:56 CEST 2017
Final Memory: 7M/155M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project FxClock: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [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/MojoExecutionException
当我打开nbactions.xml时,配置文件操作未设置,因此它使用默认操作,但无法构建

nbactions.xml:

<actions>
    <action>
        <actionName>run</actionName>
        <goals>
            <goal>clean</goal>
            <goal>package</goal>
            <goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
        </goals>
        <properties>
            <runfx.args>-jar "${project.build.directory}/${project.build.finalName}.jar"</runfx.args>
        </properties>
    </action>
    <action>
        <actionName>debug</actionName>
        <goals>
            <goal>clean</goal>
            <goal>package</goal>
            <goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
        </goals>
        <properties>
            <runfx.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -Dglass.disableGrab=true -jar "${project.build.directory}/${project.build.finalName}.jar"</runfx.args>
            <jpda.listen>true</jpda.listen>
        </properties>
    </action>
</actions>

跑
清洁的
包裹
org.codehaus.mojo:execmaven插件:1.2.1:exec
-jar“${project.build.directory}/${project.build.finalName}.jar”
调试
清洁的
包裹
org.codehaus.mojo:execmaven插件:1.2.1:exec
-Xdebug-Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address}-Dglass.disableGrab=true-jar“${project.build.directory}/${project.build.finalName}.jar”
真的
有没有一种方法可以使用
标记设置评测

这里是pom.xml,我只是将
&
更改为1.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.upce</groupId>
<artifactId>FxClock</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>FxClock</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <mainClass>com.upce.fxclock.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>
                <execution>
                    <id>default-cli</id>
                    <goals>
                        <goal>exec</goal>                            
                    </goals>
                    <configuration>
                        <executable>${java.home}/bin/java</executable>
                        <commandlineArgs>${runfx.args}</commandlineArgs>
                    </configuration>
                </execution>
            </executions>  
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <compilerArguments>
                    <bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
                </compilerArguments>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.16</version>
            <configuration>
                <additionalClasspathElements>
                    <additionalClasspathElement>${java.home}/lib/jfxrt.jar</additionalClasspathElement>
                </additionalClasspathElements>
            </configuration>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>org.gavaghan</groupId>
        <artifactId>geodesy</artifactId>
        <version>1.1.3</version>
    </dependency>
    <dependency>
        <groupId>de.jensd</groupId>
        <artifactId>fontawesomefx</artifactId>
        <version>8.9</version>
    </dependency>
</dependencies>
</project>

4.0.0
com.upce
FxClock
1.0-快照
罐子
FxClock
UTF-8
com.upce.fxclock.MainApp
您的组织
org.apache.maven.plugins
maven依赖插件
2.6
解包依赖项
包裹
解包依赖项
系统
junit,org.mockito,org.hamcrest
${project.build.directory}/classes
org.codehaus.mojo
execmaven插件
1.2.1
解包依赖项
包裹
执行官
${java.home}/./bin/javafxpacker
-createjar
-nocss2bin
-应用类
${mainClass}
-srcdir
${project.build.directory}/classes
-奥特迪尔
${project.build.directory}
-外锉
${project.build.finalName}.jar
默认cli
执行官
${java.home}/bin/java
${runfx.args}
org.apache.maven.plugins
maven编译器插件
3.1
1.8
1.8
${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar
org.apache.maven.plugins
maven surefire插件
2.16
${java.home}/lib/jfxrt.jar
org.gavaghan
大地测量学
1.1.3
德詹斯
fontawesomefx
8.9

解决方法:使用外部分析

在NetBeans中:

  • 正常运行项目
  • Profile->附加到外部进程
  • 附加
  • 选择要评测的正在运行的java进程
  • 当您需要分析应用程序的启动时,这可能不起作用