【发布时间】:2020-04-19 00:21:48
【问题描述】:
我正在使用 Maven 和 jetty 插件在本地启动我的应用程序。 而且我已经看到了可以在 Jetty contextXML 中使用占位符的方法。 这是我连接码头插件的 pom.xml 的一部分(位于单独的模块中):
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<stopKey>${test.jetty.stop-key}</stopKey>
<stopPort>${test.jetty.stop-port}</stopPort>
<webAppConfig>
<contextPath>/${test.contextPath}/*</contextPath>
</webAppConfig>
<httpConnector>
<port>${jetty.port}</port>
<host>${jetty.host}</host>
</httpConnector>
<contextXml>${project.basedir}/src/main/resources/jetty/${jetty.mode}-jetty.xml</contextXml>
</configuration>
<dependencies>
...
</dependencies>
</plugin>
这是我的 stub-jetty.xml 文件的一部分:
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
...
<New id="loggerCF" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg></Arg>
<Arg>jms/logger/connectionFactory/loggerCF</Arg>
<Arg>
<New class="org.apache.activemq.ActiveMQConnectionFactory">
<Arg>tcp://${active-mq.host}:${active-mq.port}</Arg>
</New>
</Arg>
</New>
</Configure>
main pom.xml 文件中定义的参数“active-mq.host”和“active-mq.port”。
当我运行时,我收到下一个异常:
Caused by: java.net.URISyntaxException: Illegal character in authority at index 6: tcp://${active-mq.host}:${active-mq.port}
at java.net.URI$Parser.fail (URI.java:2848)
...
所以我知道 Jetty 不明白需要将占位符更改为 Maven 属性中的值。如何解决这个问题或我能读到什么?
【问题讨论】: