`
wbj0110
  • 浏览: 1602050 次
  • 性别: Icon_minigender_1
  • 来自: 上海
文章分类
社区版块
存档分类
最新评论

How to Manage Maven Third Party Jars

阅读更多

bin/mvn-install.sh

01.#!/usr/bin/env bash
02.#
03.# Install local jar files into Maven repository. The artifact name would be same
04.# as the filename minus the extension.
05.# :Author: Zemian Deng
06.# :Date: 2013/06/17
07.#
08.# Usage:
09.#   # Print as maven dependency used in pom file
10.#   mvn-install.sh mygroup 1.0.0 lib/*.jar
11.#
12.#   # Install jar files into local maven repo
13.#   RUN_TYPE=install mvn-install.sh mygroup 1.0.0 lib/*.jar
14.#
15.#   # Deploy jar files into remote maven repo
17.#   RUN_TYPE=deploy mvn-install.sh mygroup 1.0.0 lib/*.jar
18.#
19. 
20.# Capture command arguments and options
21.GROUP=$1
22.shift
23.VERSION=$1
24.shift
25.FILES="$@"
26.if [[ "$GROUP" == "" || "$VERSION" == "" || "$FILES" == "" ]]; then
27.printf "ERROR: invalid arguments: GROUP VERSION FILES...\n"
28.exit 1
29.fi
30. 
31.RUN_TYPE=${RUN_TYPE:="print"} # values: print|install|deploy
32.REPO_ID=${REPO_ID:="nexus-server"} # Id defined in user's settings.xml for authentication
34. 
35.# For each file, perform action based on run type.
36.for FILE in $FILES; do
37.ARTIFACT=`basename $FILE '.jar'`
38.if [[ "$RUN_TYPE" == "deploy" ]]; then
39.printf "Deploying file=$FILE as artifact=$ARTIFACT to repo=$REPO_URL\n"
40.mvn deploy:deploy-file \
41.-DrepositoryId=$REPO_ID -Durl=$REPO_URL \
42.-DgroupId=$GROUP -DartifactId=$ARTIFACT -Dversion=$VERSION -Dpackaging=jar \
43.-Dfile=$FILE
44.elif [[ "$RUN_TYPE" == "install" ]]; then
45.printf "Installing file=$FILE as artifact=$ARTIFACT\n"
46.mvn install:install-file \
47.-DgroupId=$GROUP -DartifactId=$ARTIFACT -Dversion=$VERSION -Dpackaging=jar \
48.-Dfile=$FILE
49.elif [[ "$RUN_TYPE" == "print" ]]; then
50.printf "        <dependency>\n"
51.printf "            <groupId>$GROUP</groupId>\n"
52.printf "            <artifactId>$ARTIFACT</artifactId>\n"
53.printf "            <version>$VERSION</version>\n"
54.printf "        </dependency>\n"
55.fi
56.done
分享到:
评论

相关推荐

    maven 查找可用jars

    本文将深入探讨“maven查找可用jars”的主题,帮助开发者更好地理解和利用Maven的库资源。 首先,Maven中央仓库是Java开发中最常用的存储库,其中包含了大量公开发布的开源项目JAR文件。开发者可以通过Maven的依赖...

    Maven: Unable to import maven project解决方案.pdf

    然而,开发者在使用IntelliJ IDEA(简称Idea)导入Maven项目时,可能会遇到“Unable to import Maven project”的错误提示,这会阻碍项目的正常启动和开发工作。本文将详细解释这个问题的原因,并提供解决方案。 ...

    simple-xml-safe-2.7.1-API文档-中文版.zip

    Maven坐标:com.carrotsearch.thirdparty:simple-xml-safe:2.7.1; 标签:carrotsearch、thirdparty、simple、xml、safe、中文文档、jar包、java; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件...

    addjars-maven-plugin-1.0.jar

    官方版本,亲测可用

    maven下载QRCode.jar包

    在IT行业中,Maven是一个广泛使用的项目管理和综合工具,它主要负责构建、依赖管理和项目信息管理。本话题聚焦于如何通过Maven下载`QRCode.jar`包,这是一款用于生成二维码的Java库。二维码(Quick Response Code)...

    addjars-maven-plugin-1.0.1.jar

    官方版本,亲测可用

    how to create a j2ee with maven

    下载Maven的最新版本,解压到指定目录,并在系统的环境变量中设置`M2_HOME`指向Maven的安装路径,同时将`%M2_HOME%\bin`添加到`PATH`变量中,以便在命令行中直接运行Maven命令。 创建J2EE项目的第一步是定义项目...

    Apache Maven Dependency Management

    Manage your Java and JEE project dependencies with ease with this hands-on guide to Maven Overview Improve your productivity by efficiently managing dependencies. Learn how to detect and fix ...

    gradle-publish-to-MavenLocal.zip

    我们将主要关注`gradle-publish-to-MavenLocal.zip`这个压缩包中的内容,它包含了一个使用Kotlin DSL配置的Gradle项目。 首先,让我们了解`gradle-publish-to-MavenLocal`这个标题所蕴含的知识点。这通常意味着我们...

    apach-maven-3.6.0

    Apache Maven is a software project management and comprehension tool. Based on the concept of a project ...This site is separated into the following sections, depending on how you'd like to use Maven

    Apache.Maven.Cookbook.1785286129

    Apache Maven Cookbook is for those who want to learn how Apache Maven can be used for build automation. It is also meant for those familiar with Apache Maven, but want to understand the finer nuances ...

    Jenkins编译报错Failed to execute goal org.apache.maven.plugins_maven-clean-plugin

    Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project

    Intellij IDEA 与maven 版本不符

    这个问题通常表现为在尝试导入Maven项目时,IDE返回一个错误提示,如:“Unable to import maven project: See logs for details”,并在事件日志(Event Log)中显示更详细的错误信息,例如:“No implementation for...

    TestNG_Maven_how_to

    ### TestNG与Maven配置详解 #### 一、概述 在软件开发过程中,测试是确保产品质量的关键步骤之一。其中,单元测试尤为重要,它能够帮助开发者快速定位问题并提高代码质量。TestNG作为Java领域内一个强大的测试框架...

    maven 3.8.8 解压安装版

    于是希望有一种标准化的方式构建项目,一个清晰的方式定义项目的组成,一个容易的方式发布项目的信息,以及一种简单的方式在多个项目中共享JARs。 Maven的主要目标是允许开发人员理解完整的 在最短的时间内完成开发...

    apache-maven-3.3.9.rar

    the concept of a Project Object Model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information. Documentation ------------- The most up-to-date...

    Java, Eclipse, Maven & JSF tutorial

    Maven 2 is a powerful tool that promotes convention over configuration and you need...tutorial provides an example of how to make Maven and Eclipse collaborate. Also covers the popular JSF Web framework.

    apache-maven-3.8.6-bin.zip

    在Maven中,项目库(Jars)将维护在Maven存储库中,并且可以在项目之间共享。我们不需要像项目通常使用Ant之类的工具那样将Jars包含在项目的源代码中。这是Apache Maven项目的主要目标: 使构建过程变得容易。 提供...

Global site tag (gtag.js) - Google Analytics