我有一个jetty服务器,我想使用maven与服务器一起运行一个类。
以下结构是我项目的相关部分:
${basedir}/
- pom.xml
- server/
- pom.xml
- src/main/java/server/
- NotificationTest.java
- test/..
服务器目录中的pom.xml:
<!-- ... -->
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty-maven-plugin.version}</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<httpConnector>
<port>8080</port>
</httpConnector>
<webApp>
<contextPath>/test</contextPath>
</webApp>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.http2</groupId>
<artifactId>http2-server</artifactId>
<version>${jetty-maven-plugin.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-alpn-server</artifactId>
<version>${jetty-maven-plugin.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
<!-- ... -->
目前,我在同一个pom.xml中有以下配置文件,以便运行NotificationTest类:
<profiles>
<profile>
<id>databaseListener</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>server.NotificationTest</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
但是这样我需要分别运行这两个进程:
mvn jetty:run
exec:java -P databaseListener
如何在一个命令中运行它们?