Maven プラグインを介して実行するときにVertX Mertricsを機能させようとしています。exec:java
アプリケーションをfatjarにパッケージ化して実行すると、すべてが期待どおりに機能しますjava -jar fat.jar -conf config.json -Dvertx.metrics.options.enabled=true
で実行すると、次のmvn clean package exec:java -DskipTests
ように表示されます。
2016-03-22 18:39:58.833 WARN i.v.c.i.VertxImpl:348 - Metrics has been set to enabled but no VertxMetricsFactory found on classpath
私はいくつかのアプローチを試しました:
io.vertx:vertx-dropwizard-metrics:3.2.1
コンパイルの依存関係として追加- 社内メトリクスの実装を作成し、
src/main/resources/META-INF/services/io.vertx.core.spi.VertxMetricsFactory
ファイルを使用して登録します (実際に にコピーされていることを再確認しますtarget/classes/META-INF/services/io.vertx.core.spi.VertxMetricsFactory
) 。 - また
${basedir}/src/main/resources
、追加のクラスパス要素として追加します(前のポイントに加えて)
ServiceLoader
実際に空のイテレータを返すデバッガを再確認しました。
これは私の実行プラグイン構成です:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<additionalClasspathElements>
<element>${basedir}/src/main/resources</element>
</additionalClasspathElements>
<mainClass>io.vertx.core.Launcher</mainClass>
<commandlineArgs>run ${vertx.mainVerticle} -conf ${vertx.config}</commandlineArgs>
<systemProperties>
<systemProperty>
<key>vertx.logger-delegate-factory-class-name</key>
<value>io.vertx.core.logging.SLF4JLogDelegateFactory</value>
</systemProperty>
<systemProperty>
<key>vertx.metrics.options.enabled</key>
<value>true</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
これは機能exec:exec
する構成ですが、それを行うことが(不可能)可能であるかどうか、およびその理由を理解したいexec:java
<profile>
<id>exec</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
<phase>process-classes</phase>
<configuration>
<executable>java</executable>
<arguments>
<argument>-Dvertx.metrics.options.enabled=true</argument>
<argument>-Dvertx.logger-delegate-factory-class-name=${vertx.logger-delegate-factory-class-name}</argument>
<argument>-classpath</argument>
<classpath />
<argument>io.vertx.core.Launcher</argument>
<argument>run</argument>
<argument>${vertx.mainVerticle}</argument>
<argument>-conf</argument>
<argument>${vertx.config}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>