在 netbeans 8.2 中,我能够使用本机捆绑包创建安装程序。我尝试使用 maven 和 javafx-maven-plugin 在 Netbeans 11 中执行相同的操作。
我使用 install jfx:native 作为构建操作。
这是我的 pom.xml 文件 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 ClienteIntegradorMaven 1.0-SNAPSHOT UTF-8 12 12 ClienteIntegradorMaven
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>7.4.1.jre12</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>12.0.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>12.0.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.12</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.11.2</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>12</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.3</version>
<configuration>
<release>12</release>
<jlinkImageName>hellofx</jlinkImageName>
<launcher>launcher</launcher>
<mainClass>clienteintegrador4.ClienteIntegrador4</mainClass>
<executable>C:\Program Files\Java\jdk-12.0.2\bin\java</executable> …Run Code Online (Sandbox Code Playgroud) 对于 OneTimeWorkRequest,我们可以使用 WorkContinuation 来确保如果作业已经被安排,我们可以保留或替换它。PeriodicWorkRequest 没有这样的选项,因此每次创建我的主要活动时都会创建一个新作业,一段时间后我会收到此异常。
java.lang.IllegalStateException: Apps may not schedule more than 100 distinct jobs
Run Code Online (Sandbox Code Playgroud)
所以我正在尝试以下内容来创建一个“独特的周期性作品”
public void schedule(){
Constraints constraints = new Constraints.Builder().setRequiresBatteryNotLow(true).build();
OneTimeWorkRequest zombieSpawnWorker = new OneTimeWorkRequest.Builder(ZombieSpawnWorker
.class).setInitialDelay(15, TimeUnit.MINUTES).setConstraints(constraints).addTag(ZombieSpawnWorker.TAG).build();
this.setUuid(zombieSpawnWorker.getId());
WorkManager.getInstance().beginUniqueWork(TAG,
ExistingWorkPolicy.KEEP,
OneTimeWorkRequest.from(ZombieSpawnWorker.class));
}
Run Code Online (Sandbox Code Playgroud)
然后在工作结束时再次调用此方法
public WorkerResult doWork() {
try {
//work to be done
} catch (Exception e) {
Log.e(TAG,e.getLocalizedMessage());
return WorkerResult.FAILURE;
}
schedule();
return WorkerResult.SUCCESS;
}
Run Code Online (Sandbox Code Playgroud)