我使用下面的pom.xml
文件打包我的JavaFX 8应用程序。当我运行NetBeans时,我收到以下错误:
无法在项目上执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:exec(default-cli)CoperativeERP:目标org.codehaus.mojo的参数'executable':exec-maven-插件:1.2.1:exec缺失或无效 - > [帮助1]
<?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>re.iprocu</groupId>
<artifactId>CoperativeERP</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>CoperativeERP</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mainClass>re.iprocu.coperativeerp.MainApp</mainClass>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<organization>
<!-- Used as the 'Vendor' for JNLP generation -->
<name>Your Organisation</name>
</organization>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.1.4</version>
<configuration>
<mainClass></mainClass>
</configuration>
<executions>
<execution>
<id>create-jfxjar</id>
<phase>package</phase>
<goals>
<goal>build-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
我正在使用jdk 1.8.0_77
和NetBeans IDE 8.1。
我是Maven和JavaFX打包的新手,所以我期待易于使用和理解的东西。
答案 0 :(得分:0)
看看:
final NsdManager.DiscoveryListener discoveryListener = new NsdManager.DiscoveryListener() {
@Override
public void onDiscoveryStarted(String s) {
Log.i(TAG, "onDiscoveryStarted: " + s);
}
@Override
public void onServiceFound(NsdServiceInfo nsdServiceInfo) {
Log.i(TAG, "onServiceFound: " + nsdServiceInfo.toString());
}
@Override
public void onServiceLost(NsdServiceInfo nsdServiceInfo) {
Log.i(TAG, "onServiceLost: " + nsdServiceInfo.toString());
}
@Override
public void onDiscoveryStopped(String s) {
Log.i(TAG, "onDiscoveryStopped: " + s);
}
@Override
public void onStartDiscoveryFailed(String s, int i) {
Log.i(TAG, "onStartDiscoveryFailed: " + s);
}
@Override
public void onStopDiscoveryFailed(String s, int i) {
Log.i(TAG, "onStopDiscoveryFailed: " + s);
}
};
final NsdManager manager = (NsdManager) getSystemService(Context.NSD_SERVICE);
manager.discoverServices("_http._tcp", NsdManager.PROTOCOL_DNS_SD, discoveryListener);
它是空的。那里应该写出主类完全指定的名称(例如<configuration>
<mainClass></mainClass>
</configuration>
)。
查看documentation整个插件配置应如下所示:
com.myproject.Main
确保您的<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.5.0</version>
<configuration>
<vendor>YourCompany</vendor>
<mainClass>your.package.with.Launcher</mainClass>
</configuration>
</plugin>
包含主要方法(应用入口点),并确保您使用的是最新版本。另请尝试首先按<mainClass>
构建项目而不使用mvn clean package
。