xml 在maven加入Dagger2和Lombok

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xml 在maven加入Dagger2和Lombok相关的知识,希望对你有一定的参考价值。

<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>

以上是关于xml 在maven加入Dagger2和Lombok的主要内容,如果未能解决你的问题,请参考以下文章

怎么把jar包加入到maven dependencies

IntelliJ 中Maven pom.xml依赖不生效解决

markdown Curage lombo-aortique par coelioscopie(CLARétropé).md

maven的pom.xml报错

Maven添加外部jar包到本地仓库

maven之第一个maven程序