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
16.
# export REPO_URL=http://localhost/nexus/content/repositories/thirdparty
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
33.
REPO_URL=${REPO_URL:=
"http://localhost/nexus/content/repositories/thirdparty"
}
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
相关推荐
NULL 博文链接:https://zhaoningbo.iteye.com/blog/1072794
The book is ideal for for experienced developers who are already familiar with build automation, but want to learn how to use Maven and apply its concepts to the most difficult scenarios in build ...
Maven坐标:com.carrotsearch.thirdparty:simple-xml-safe:2.7.1; 标签:carrotsearch、thirdparty、simple、xml、safe、中文文档、jar包、java; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件...
官方版本,亲测可用
This book is a step-by-step guide that shows you how to use Apache Maven in an optimal way to address your enterprise build requirements. What you'll learn Apply Maven best practices in designing a ...
maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装maven安装...
官方版本,亲测可用
契约测试jars by Maven依赖
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 ...
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
Idea 导入Maven项目,在加载pom.xml文件内容时,弹窗提示错误信息 Unable to import maven project的解决方案。文档是包含在操作时遇到的问题以及问题的解决方案,搭配图片,图文并茂,方便读者准确定位到问题以及更...
Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project
Explains Maven configuration for TestNG
Intellij IDEA 与maven 版本不符 Unable to import maven project See logs for details: No implementation for org.apache.maven.model.path.PathTranslator was bound
于是希望有一种标准化的方式构建项目,一个清晰的方式定义项目的组成,一个容易的方式发布项目的信息,以及一种简单的方式在多个项目中共享JARs。 Maven的主要目标是允许开发人员理解完整的 在最短的时间内完成开发...
In this short 100-page book, you'll learn all about Maven and how to set it up to use. You'll learn about the Maven life cycle and how to effectively leverage and use it. Also, you'll learn the basics...
how to make a project with SVN+MEAVEN,使用svn和maven构建java工程。
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...
Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令Maven 命令
Maven项目对象模型(POM),可以通过一小段描述信息来管理项目的构建,...于是希望有一种标准化的方式构建项目,一个清晰的方式定义项目的组成,一个容易的方式发布项目的信息,以及一种简单的方式在多个项目中共享JARs。