mvn安装jar包到本地仓库

  • 安装 jar 包到本地仓库命令:
mvn install:install-file -DgroupId=groupId -DartifactId=artifactId -Dversion=version -Dpackaging=jar -Dfile=需安装到本地仓库到jar文件路径(需包含完整的文件名,目录部分为相对目录或者绝对目录均可)
  • 安装示例:
mvn install:install-file -DgroupId=com.ververica -DartifactId=flink-connector-mysql-cdc -Dversion=2.4-SNAPSHOT -Dpackaging=jar -Dfile=/Users/yijian/IdeaProjects/flink-cdc-connectors/flink-connector-mysql-cdc/target/flink-connector-mysql-cdc-2.4-SNAPSHOT.jar

注意需在 flink-connector-mysql-cdc 的 pom.xml 文件所在目录下执行,如:

cd /Users/yijian/IdeaProjects/flink-cdc-connectors/flink-connector-mysql-cdc
mvn install:install-file -DgroupId=com.ververica -DartifactId=flink-connector-mysql-cdc -Dversion=2.4-SNAPSHOT -Dpackaging=jar -Dfile=/Users/yijian/IdeaProjects/flink-cdc-connectors/flink-connector-mysql-cdc/target/flink-connector-mysql-cdc-2.4-SNAPSHOT.jar

或父 pom.xml 文件所在目录下执行,如:

cd /Users/yijian/IdeaProjects/flink-cdc-connectors
mvn install:install-file -DgroupId=com.ververica -DartifactId=flink-connector-mysql-cdc -Dversion=2.4-SNAPSHOT -Dpackaging=jar -Dfile=/Users/yijian/IdeaProjects/flink-cdc-connectors/flink-connector-mysql-cdc/target/flink-connector-mysql-cdc-2.4-SNAPSHOT.jar

否则会“BUILD FAILURE”,成功如下:

yijian@MacBook-Pro-16 flink-connector-mysql-cdc % mvn install:install-file -DgroupId=com.ververica -DartifactId=flink-connector-mysql-cdc -Dversion=2.4-SNAPSHOT -Dpackaging=jar -Dfile=/Users/yijian/IdeaProjects/flink-cdc-connectors/flink-connector-mysql-cdc/target/flink-connector-mysql-cdc-2.4-SNAPSHOT.jar
[INFO] Scanning for projects...
[INFO] 
[INFO] --------------< com.ververica:flink-connector-mysql-cdc >---------------
[INFO] Building flink-connector-mysql-cdc 2.4-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- install:2.5.2:install-file (default-cli) @ flink-connector-mysql-cdc ---
[INFO] Installing /Users/yijian/IdeaProjects/flink-cdc-connectors/flink-connector-mysql-cdc/target/flink-connector-mysql-cdc-2.4-SNAPSHOT.jar to /Users/yijian/.m2/repository/com/ververica/flink-connector-mysql-cdc/2.4-SNAPSHOT/flink-connector-mysql-cdc-2.4-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.396 s
[INFO] Finished at: 2023-02-26T10:54:28+08:00
[INFO] ------------------------------------------------------------------------

你可能感兴趣的:(maven,java,jar,mysql,java,maven,mvn)