Specifying logback configuration when using maven exec:exec

If you don’t want your logback configuration stored in your jar, but you want to be able to execute your java program with the exec-maven-plugin (using mvn exec:exec), you can specify the default logback configuration as follows. More details on logback configuration can be found here: http://logback.qos.ch/manual/configuration.html

<plugin>
	<groupId>org.codehaus.mojo</groupId>
	<artifactId>exec-maven-plugin</artifactId>
	<version>1.2.1</version>
	<executions>
		<execution>
			<goals>
				<goal>exec</goal>
			</goals>
		</execution>
	</executions>
	<configuration>
		<executable>java</executable>
		<arguments>
			<argument>-cp</argument>
			<classpath/>
			<argument>-Dlogback.configurationFile=${basedir}/src/main/resources/logback.xml</argument>
			<argument>com.possemeeg.test.experiment.Program</argument>
		</arguments>
	</configuration>
</plugin>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s