问题描述
我分叉了 Confluent的Kafka Connect HDFS编写器,现在我想要将该版本的jar部署到我的本地Nexus.
I've forked Confluent's Kafka Connect HDFS writer and now I'd like to deploy a version of this jar to my local Nexus.
mvn clean deploy
就像护身符一样,部署了jar.
mvn clean deploy
Works like a charm and deploys the jar.
https://[nexus]/repository/releases/io/confluent/kafka-connect-hdfs/5.0.0/kafka-connect-hdfs-5.0.0.jar
到目前为止,还不错,但是要区分融合版本和我自己的部署,我想将构建版本更改为类似5.0.0-1
的名称(最好是按下时的标签名称,但这是第2步)
So far so good, but to make a distinction between the confluent versions and my own deployment I'd like to change the version of the build to something like 5.0.0-1
or so (preferably the tag name when pushed, but that's step 2)
pom.xml与 5.0.0-post 版本,但此处是最重要的部分:
The pom.xml is basically the same as the 5.0.0-post release, but here the most important parts:
<parent>
<groupId>io.confluent</groupId>
<artifactId>kafka-connect-storage-common-parent</artifactId>
<version>5.0.0</version>
</parent>
<artifactId>kafka-connect-hdfs</artifactId>
<packaging>jar</packaging>
<name>kafka-connect-hdfs</name>
<organization>
<name>Confluent, Inc.</name>
<url>http://confluent.io</url>
</organization>
<url>http://confluent.io</url>
<description>
A Kafka Connect HDFS connector for copying data between Kafka and Hadoop HDFS.
</description>
...
<dependencies>
...
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-connect-storage-common</artifactId>
<version>${confluent.version}</version>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-connect-storage-core</artifactId>
<version>${confluent.version}</version>
</dependency>
...
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.confluent</groupId>
<version>0.10.0</version>
<artifactId>kafka-connect-maven-plugin</artifactId>
...
所以首先我在pom.xml中添加了<version>
标记,但是它开始将其用作所有confluent.version
的默认值,并抱怨找不到它,例如:https://[nexus]/repository/releases/io/confluent/kafka-connect-storage-hive/5.0.0-1/kafka-connect-storage-hive-5.0.0-1.pom
So first I added <version>
tags to the pom.xml, but it started using that as the default for all confluent.version
and complained that it couldn't find for example: https://[nexus]/repository/releases/io/confluent/kafka-connect-storage-hive/5.0.0-1/kafka-connect-storage-hive-5.0.0-1.pom
接下来,我尝试了来自maven的版本插件mvn versions:set -DnewVersion=5.0.0-1 clean deploy
但这抱怨父母:
我什至不在乎代码中的版本是否为5.0.0,我只是想在我们的工件中部署到其他版本.
I don't even care if the version is 5.0.0 in the code, I just wat to deploy to a different version in our artifactory.
我不是行家专家,所以也许我缺少一些非常基本的线索,但是欢迎大家提供帮助.
I'm not a maven expert, so maybe I'm missing some very basic clue, but all help is welcome.
推荐答案
所以有一些很好的建议,但是最后对我来说最有效的一件事是对Maven使用deploy:deploy-file
命令.
So there were some good suggestions, but in the end the one thing that worked best for me in our setup was to use the deploy:deploy-file
command for maven.
mvn deploy:deploy-file \
-Dfile=target/kafka-connect-hdfs-5.0.0.jar \
-DrepositoryId=[nexus id] \
-Durl=[nexus url] \
-Dversion=$TAG \
-DgroupId=io.confluent \
-DartifactId=kafka-connect-hdfs
主要缺点是我必须重新指定pom.xml中已经存在的参数(artifactId
,groupId
等),但它确实有效,这才是:-)
The major downside was that I had to respecify parameters that were already present in the pom.xml (artifactId
, groupId
, ect), but it works, and that's what counts :-)
这篇关于从maven部署到nexus时指定版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!