cyc1111 发表于 2017-2-27 09:59:48

通过properties-maven-plugin为Jetty Maven Plugin添加系统变量

  通过properties-maven-plugin为Jetty Maven Plugin添加系统初始化变量。也是为解决当将依赖放到Jetty Maven Plugin的dependencies下时,Jetty Maven Plugin不能通过自身的<systemProperties>找到日志的配置文件。
 
properties-maven-plugin配置:

      <plugin>
<!-- As of Jetty 7.5.0 and above, Jetty classes now use static log initializers. These static log initializers cause the Log4j system to be initialized before system properties are loaded. Use a separate maven plugin such as the properties-maven-plugin to set the log4j system properties before the Jetty plugin is initialized. -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>set-system-properties</goal>
</goals>
<configuration>
<properties>
<property>
<name>log4j.configuration</name>
<value>file:/${jetty.home}/resources/log4j.properties</value>
</property>
<property>
<name>snx.arch.asjndi.path</name>
<value>${jetty.home}/etc/company/system/asJndi.properties</value>
</property>
</properties>
</configuration>
</execution>
</executions>
</plugin>
 
Jetty Maven Plugin

      <plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.10.v20130312</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<connectors>
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<port>9080</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
<useProvidedScope>true</useProvidedScope>
</configuration>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
</dependencies>
</plugin>
 
页: [1]
查看完整版本: 通过properties-maven-plugin为Jetty Maven Plugin添加系统变量