ezhovdv
12/25/2015 - 11:30 AM

Join Dagger2 and Lombok in maven

Join Dagger2 and Lombok in maven

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.boringville.test</groupId>
	<artifactId>DaggerLombok</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>DaggerLombok</name>
	<url>http://maven.apache.org</url>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>

	<repositories>
		<repository>
			<id>repo-id</id>
			<name>repo-name</name>
			<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
		</repository>
	</repositories>

	<dependencies>
		<!-- Lombok -->
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<version>1.16.2</version>
			<scope>provided</scope>
		</dependency>

		<!-- Dagger 2 -->
		<dependency>
			<groupId>com.google.dagger</groupId>
			<artifactId>dagger</artifactId>
			<version>2.0-SNAPSHOT</version>
		</dependency>

		<dependency>
			<groupId>com.google.dagger</groupId>
			<artifactId>dagger-compiler</artifactId>
			<version>2.0-SNAPSHOT</version>
			<optional>true</optional>
			<scope>provided</scope>
		</dependency>
	</dependencies>

	<build>
		<sourceDirectory>target/generated-sources/delombok</sourceDirectory>
		<plugins>
			<plugin>
				<groupId>org.projectlombok</groupId>
				<artifactId>lombok-maven-plugin</artifactId>
				<version>1.16.2.0</version>
				<dependencies>
					<dependency>
						<groupId>sun.jdk</groupId>
						<artifactId>tools</artifactId>
						<version>1.7</version>
						<scope>system</scope>
						<systemPath>${java.home}/../lib/tools.jar</systemPath>
					</dependency>
				</dependencies>
				<executions>
					<execution>
						<phase>generate-sources</phase>
						<goals>
							<goal>delombok</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<addOutputDirectory>false</addOutputDirectory>
					<sourceDirectory>src/main/java</sourceDirectory>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.2</version>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-shade-plugin</artifactId>
				<version>2.3</version>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>shade</goal>
						</goals>
						<configuration>
							<transformers>
								<transformer
									implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
									<mainClass>com.boringville.test.daggerlombok.App</mainClass>
								</transformer>
							</transformers>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>