我有一个项目,我已经做了一些重构(和模块名称澄清)。如何将由一个maven模块生成的jar附加到具有分类器的另一个模块?
因此,neo4j-connector-impl
模块现在变成了neo4j-connector-1.6
。现在,为了更好的兼容性,我希望这个项目生成的jar也可以作为neo4j-connector-impl
(它的旧名称,如果你关注我的话)。
我已经在这些GAV坐标下创建了一个pom
类型的项目,并尝试使用maven-dependency-plugin和build-helper-maven-plugin的混合来附加罐子。
不幸的是,每一个我建我的项目的时候,也罐子是不是在Maven仓库和Maven说
[INFO] Installing C:\Users\ndx\Documents\workspaces\git\neo4j-connector\neo4j-connector-impl-parent\neo4j-connector-impl\neo4j-connector-impl-1.6.jar to C:\Users\ndx\.m2\repository\com\netoprise\neo4j-connector-impl\1.6-SNAPSHOT\neo4j-connector-impl-1.6-SNAPSHOT.jar
[DEBUG] Skipped re-installing C:\Users\ndx\Documents\workspaces\git\neo4j-connector\neo4j-connector-impl-parent\neo4j-connector-impl\neo4j-connector-impl-1.6.jar to C:\Users\ndx\.m2\repository\com\netoprise\neo4j-connector-impl\1.6-SNAPSHOT\neo4j-connector-impl-1.6-SNAPSHOT.jar, seems unchanged
所以...我怎样才能把那个罐子的分类依赖?
有关的信息,这是我的聚甲醛
<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>
<parent>
<groupId>com.netoprise</groupId>
<artifactId>neo4j-connector-impl-parent</artifactId>
<version>1.6-SNAPSHOT</version>
</parent>
<artifactId>neo4j-connector-impl</artifactId>
<packaging>pom</packaging>
<description>Compatibility module ensuring previous code can "quite" work</description>
<properties>
<dependencies.directory>${project.build.directory}/dependencies</dependencies.directory>
</properties>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}-1.6</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>${project.groupId}</includeGroupIds>
<excludeTransitive>true</excludeTransitive>
<overWriteSnapshots>true</overWriteSnapshots>
<stripVersion>true</stripVersion>
<outputDirectory>${dependencies.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- attach all projects artifact to this one in order for user projects
to have minimum integration work -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<!-- for maximum compatibility, the 1.6 version is attached as default jar artifact -->
<artifact>
<file>neo4j-connector-impl-1.6.jar</file>
<type>jar</type>
</artifact>
</artifacts>
<basedir>${dependencies.directory}</basedir>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
编辑1为什么在器物的版本号?因为该项目(neo4j-jca-connector)为各种JavaEE服务器提供对neo4j图形数据库的访问。 neo4j版本不应该受此连接器限制。因此,我们必须为用户提供一种方法来为该连接器的一个版本定义使用哪个neo4j版本(默认情况下 - 为向后兼容版本 - 1.6版本)。
因此,我们为每个版本的neo4j,n都有一个模块,这些模块在这里汇总。对于这个记录,Bouncycastle对于JDK版本是这样做的......在一个更糟糕的版本中,在我看来,因为他们直接在artifactId中使用JDK版本,我打算只做internaly:外露的构件将是neo4j-connector-impl和neo4j-connector-rar ...和分类器将允许你选择使用哪个neo4j版本。
EDIT 2欲了解更多信息,整个项目可以看出在github:https://github.com/Riduidel/neo4j-connector
父POM cotnaining行家遮阳帘插件声明的是,连接器的https://github.com/Riduidel/neo4j-connector/blob/master/neo4j-connector-impl-parent/pom.xml
工件中的版本号**不是**我的项目之一,但是是neo4j之一......我确实拥有一个依赖关系,但为此我想保持最大的兼容性。 FTR,我认为BouncyCastle也以这种方式(或通过使用分类器)与各种JDK版本保持兼容性。 – Riduidel 2013-02-25 15:32:51