一 传递依赖实例
nage依赖于bge,shanji依赖于nage
bge的pom.xml文件
<
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.hongxing
</
groupId
>
<
artifactId
>
hongxing
-
bge
</
artifactId
>
<
version
>
0.0.1-SNAPSHOT
</
version
>
<
packaging
>
jar
</
packaging
>
<
name
>
hongxing
-
bge
</
name
>
<
properties
>
<
project.build.sourceEncoding
>
UTF-8
</
project.build.sourceEncoding
>
</
properties
>
<
dependencies
>
<
dependency
>
<
groupId
>
junit
</
groupId
>
<
artifactId
>
junit
</
artifactId
>
<
version
>
3.8.1
</
version
>
<
scope
>
test
</
scope
>
</
dependency
>
</
dependencies
>
</
project
>
nage的pom.xml文件
<
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.hongxing
</
groupId
>
<
artifactId
>
hongxing
-
nage
</
artifactId
>
<
version
>
0.0.1-SNAPSHOT
</
version
>
<
packaging
>
jar
</
packaging
>
<
name
>
hongxing
-
nage
</
name
>
<
properties
>
<
project.build.sourceEncoding
>
UTF-8
</
project.build.sourceEncoding
>
</
properties
>
<
dependencies
>
<
dependency
>
<
groupId
>
junit
</
groupId
>
<
artifactId
>
junit
</
artifactId
>
<
version
>
3.8.1
</
version
>
<
scope
>
test
</
scope
>
</
dependency
>
<
dependency
>
<
groupId
>
com.hongxing
</
groupId
>
<
artifactId
>
hongxing
-
bge
</
artifactId
>
<
version
>
0.0.1-SNAPSHOT
</
version
>
</
dependency
>
</
dependencies
>
</
project
>
shanji的pom.xml文件
<
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.hongxing
</
groupId
>
<
artifactId
>
hongxing
-
shanji
</
artifactId
>
<
version
>
0.0.1-SNAPSHOT
</
version
>
<
packaging
>
jar
</
packaging
>
<
name
>
hongxing
-
shanji
</
name
>
<
properties
>
<
project.build.sourceEncoding
>
UTF-8
</
project.build.sourceEncoding
>
</
properties
>
<
dependencies
>
<
dependency
>
<
groupId
>
junit
</
groupId
>
<
artifactId
>
junit
</
artifactId
>
<
version
>
3.8.1
</
version
>
<
scope
>
test
</
scope
>
</
dependency
>
<
dependency
>
<
groupId
>
com.hongxing
</
groupId
>
<
artifactId
>
hongxing
-
nage
</
artifactId
>
<
version
>
0.0.1-SNAPSHOT
</
version
>
</
dependency
>
</
dependencies
>
</
project
>
二 排除依赖实例
nage依赖于bge,shanji只依赖于nage
bge和nage的pom.xml文件不变
shanji的pom.xml文件
<
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.hongxing
</
groupId
>
<
artifactId
>
hongxing
-
shanji
</
artifactId
>
<
version
>
0.0.1-SNAPSHOT
</
version
>
<
packaging
>
jar
</
packaging
>
<
name
>
hongxing
-
shanji
</
name
>
<
properties
>
<
project.build.sourceEncoding
>
UTF-8
</
project.build.sourceEncoding
>
</
properties
>
<
dependencies
>
<
dependency
>
<
groupId
>
junit
</
groupId
>
<
artifactId
>
junit
</
artifactId
>
<
version
>
3.8.1
</
version
>
<
scope
>
test
</
scope
>
</
dependency
>
<
dependency
>
<
groupId
>
com.hongxing
</
groupId
>
<
artifactId
>
hongxing
-
nage
</
artifactId
>
<
version
>
0.0.1-SNAPSHOT
</
version
>
<
exclusions
>
<
exclusion
>
<
groupId
>
com.hongxing
</
groupId
>
<
artifactId
>
hongxing
-
bge
</
artifactId
>
<
version
>
0.0.1-SNAPSHOT
</
version
>
</
exclusion
>
</
exclusions
>
</
dependency
>
</
dependencies
>
</
project
>