---
title: "同一个java工程打两个不同的包"
author: "pcpig"
date: "2016-08-18T18:01:38Z"
tags: []
categories: ["编程语言"]
slug: "java"
draft: false
lastmod: "2016-08-18T18:01:38Z"
id: 2318828
url: "https://pcpig.iteye.com/blog/2318828"
---

目的：1、打一个普通java包，用于spring aop
      2、用aspectj打一个包，用于字节码加强的实现方式

实现：
     
```java

     	<profiles>
		<profile>
			<id>aspectj</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>aspectj-maven-plugin</artifactId>
						<version>1.8</version>
						<executions>
							<execution>
								<goals>
									<goal>compile</goal>
								</goals>

								<configuration>
									<complianceLevel>1.7</complianceLevel>
									<source>1.7</source>
									<target>1.7</target>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<artifactId>maven-jar-plugin</artifactId>
						<executions>
							<execution>
								<id>default-jar</id>
								<phase>none</phase>
							</execution>
							<execution>
								<phase>package</phase>
								<goals>
									<goal>jar</goal>
								</goals>
								<configuration>
									<classifier>aspectj</classifier>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
     
```