我通常使用JEE和Glassfish来创建Web应用程序,但是我使用Jetty创建了一个不需要容器的Web应用程序。但是,每次运行应用程序时,我都必须手动停止当前运行的实例。这不需要很长时间,但这有点痛苦。我希望开发周期更平滑,我确信它可以在命令行自动完成,但我认为它应该是一个非常常见的问题。
我正在使用NB 8.2创建我的项目。 档案 - >新项目 - >在Categories选择" Maven",Under Projects" Java Application"
每次运行项目时,都会部署一个新的运行实例,这样在运行5次后就会有5个正在运行的程序(通常情况下这种类型的应用程序就是这种情况,但由于端口冲突,我必须停止上一个例子)。
以下任何一种都是可行的解决方案:
对于基于pom的解决方案,我正在与之合作:
<?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.kenmcwilliams</groupId>
<artifactId>MpawServices</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<!-- Web dependencies -->
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.5</version>
<type>jar</type>
</dependency>
<!-- JSON parsing -->
<dependency>
<groupId>io.fastjson</groupId>
<artifactId>boon</artifactId>
<version>0.34</version>
</dependency>
<!-- needed for DB access -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.10.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>1.6.0</version>
</dependency>
<!-- needed for Dagger2 DI -->
<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger</artifactId>
<version>2.11</version>
</dependency>
<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger-compiler</artifactId>
<version>2.11</version>
<optional>true</optional>
</dependency>
<!-- to prevent: SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder” -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.5</version>
</dependency>
<!-- AspectJ -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.7</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.8</version>
<configuration>
<complianceLevel>1.8</complianceLevel>
<source>1.8</source>
<target>1.8</target>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</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>com.kenmcwilliams.mpawservices.App</mainClass>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
答案 0 :(得分:1)
我不认为NetBeans目前有这样的功能,但您应该能够在NetBeans Jira Issue Tracker提交功能请求。事实上,这将是一个很好的功能,我也在搜索过去类似的东西。