- 浏览: 2492704 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
eclipseEE版本中使用ivy管理jar包
我以前一直都是使用maven2来管理项目的,这次公司同事比较热推ivy,更轻量级些。只用ivy管理jar包,打包和管理项目还是用ant。我看同事搭建起来项目的效果,的确比较方便实用(其实主要是我们都更熟悉ant,呵呵。其实用maven也就只用到了管理jar的功能)。这里记录一下同事的配置方法,以后备用。
ivy首页
http://ant.apache.org/ivy/index.html
eclipse插件地址
http://www.apache.org/dist/ant/ivyde/updatesite
项目上没有按照maven2那样建立目录了,而是这样建立的目录:
src java的代码目录
conf 配置文件的目录
-log4j.properties log的配置
-config.properties 项目的properties配置
test 测试代码的目录
WebContent 我的WEB-ROOT目录
build.properties ANT打包的属性文件
build.xml ANT的配置文件,这里来打包,驱动ivy下载JAR包
ivy.xml IVY的jar配置文件
ivysetttings.xml IVY的服务器地址等配置
rebel.xml 我用到的一个不用重启TOMCAT,可以重新加载class的工具的配置文件
其实主要的是build.properties,build.xml,ivy.xml,ivysettings.xml几个配置文件,内容分别如下,
ivy.settings.xml:
<ivysettings>
<settings defaultResolver="chained"/>
<resolvers>
<chain name="chained" returnFirst="true">
<filesystem name="libraries">
<artifact pattern="${ivy.conf.dir}/lib/[artifact]-[revision].[type]" />
</filesystem>
<url name="sillycat">
<artifact pattern="http://localhost:8081/nexus/content/groups/public/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<url name="sccl">
<artifact pattern="http://10.206.20.43:9999/nexus/content/groups/public/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
</chain>
</resolvers>
</ivysettings>
其中sillycat是本地私服,sccl是公司的私服,都使用的是原来maven2的nexus开源服务器。
ivy.xml是我们要管理和导入的jar包,这里只放了两个做个示例:
<ivy-module version="2.0">
<info organisation="sccl" module="swak" />
<configurations>
<conf name="release" />
</configurations>
<publications>
<artifact name="common" />
<artifact name="client" />
</publications>
<dependencies>
<!-- commons -->
<dependency org="commons-logging" name="commons-logging" rev="1.1.1"/>
<!-- spring jar -->
<dependency org="org/springframework" name="spring" rev="2.5.6"/>
</dependencies>
</ivy-module>
build.properties文件,里面配置的是build的一些信息:
app.name=ivysample
catalina.home=D:\eclipse-company\apache-tomcat-6.0.20
ant.encoding=GBK
java.level=1.5
另外就是重头戏了,ANT的build.xml文件
<project name="${app.name}" default="all" xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- some variables used -->
<property file="build.properties" />
<property name="app.name" value="${app.name}" />
<property name="src.dir" value="src" />
<property name="conf.dir" value="conf" />
<property name="build.dir" value="build" />
<property name="dist.dir" value="dist" />
<property name="web.dir" value="WebContent" />
<property name="lib.dir" value="${web.dir}/WEB-INF/lib" />
<property name="tomcat.dir" value="${catalina.home}" />
<property name="ivy.install.version" value="2.0.0" />
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<!-- paths used for compilation and run -->
<path id="compile.path.id">
<fileset dir="${tomcat.dir}\lib" />
<fileset dir="${lib.dir}" />
<path location="${build.dir}" />
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="${ivy.jar.file}" />
<target name="download-ivy">
<mkdir dir="${ivy.jar.dir}" />
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true" />
</target>
<!-- ================================= target: resolve ================================= -->
<target name="resolve" depends="download-ivy" description="--> retreive dependencies with ivy">
<ivy:retrieve pattern="${web.dir}/WEB-INF/lib/[artifact]-[revision].[ext]" />
</target>
<!-- ================================= target: clean-cache ================================= -->
<target name="clean-cache-lib" description="--> clean the ivy cache">
<delete dir="${ivy.home}/cache" />
</target>
<!-- ================================= target: clean ================================= -->
<target name="clean" description="--> clean the project">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<!-- ================================= target: prepare ================================= -->
<target name="prepare" description="--> make-dir build , dist">
<tstamp />
<mkdir dir="${build.dir}" />
<mkdir dir="${dist.dir}" />
<echo message="built at ${DSTAMP}-${TSTAMP}" />
<echo message="ant.version - ${ant.version}" />
<echo message="ant.java.version - ${ant.java.version}" />
<echo message="ivy.cache.dir - ${ivy.home}/cache"/>
</target>
<!-- ================================= target: compile ================================= -->
<target name="compile" depends="prepare" description="--> Compile Java sources">
<!-- Compile Java classes as necessary -->
<property name="compile.java.encoding" value="${ant.encoding}" />
<mkdir dir="${build.dir}/WEB-INF/classes" />
<javac srcdir="${src.dir}" destdir="${build.dir}/WEB-INF/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" encoding="${ant.encoding}" source="${java.level}">
<classpath refid="compile.path.id" />
</javac>
<copy todir="${build.dir}/WEB-INF/classes">
<fileset dir="${src.dir}">
<include name="**/*.xml"/>
<include name="**/*.txt"/>
<include name="**/*.properties"/>
<exclude name="config.properties"/>
<exclude name="log4j.properties"/>
</fileset>
</copy>
</target>
<!-- ================================= target: javadoc ================================= -->
<target name="javadoc" depends="compile" description="-->Create Javadoc API documentation">
<mkdir dir="${dist.dir}/api-docs" />
<javadoc sourcepath="${src.dir}" destdir="${dist.dir}/api-docs" packagenames="*">
<classpath refid="compile.path.id" />
</javadoc>
</target>
<target name="copyWeb">
<copy todir="${build.dir}">
<fileset dir="${web.dir}">
<exclude name="WEB-INF/classes/**"/>
</fileset>
</copy>
</target>
<target name="war" depends="clean,compile,copyWeb" description="--> build web application war package">
<war destfile="${dist.dir}/${app.name}.war" webxml="${build.dir}/WEB-INF/web.xml">
<fileset dir="${build.dir}"/>
</war>
<copy tofile="${dist.dir}/config.properties" file="${conf.dir}/config.properties"/>
<copy tofile="${dist.dir}/log4j.properties" file="${conf.dir}/log4j.properties"/>
</target>
<target name="all" depends="war,javadoc" description="clean, build jar package, generate api- doc">
</target>
</project>
配置就完成了,运行以下ANT命令就行了
ant war 打war包
ant resolve 准备jar包
ant clean-cache-lib 将jar包的本地cache清空,以得到相同版本号刷新版本jar
我以前一直都是使用maven2来管理项目的,这次公司同事比较热推ivy,更轻量级些。只用ivy管理jar包,打包和管理项目还是用ant。我看同事搭建起来项目的效果,的确比较方便实用(其实主要是我们都更熟悉ant,呵呵。其实用maven也就只用到了管理jar的功能)。这里记录一下同事的配置方法,以后备用。
ivy首页
http://ant.apache.org/ivy/index.html
eclipse插件地址
http://www.apache.org/dist/ant/ivyde/updatesite
项目上没有按照maven2那样建立目录了,而是这样建立的目录:
src java的代码目录
conf 配置文件的目录
-log4j.properties log的配置
-config.properties 项目的properties配置
test 测试代码的目录
WebContent 我的WEB-ROOT目录
build.properties ANT打包的属性文件
build.xml ANT的配置文件,这里来打包,驱动ivy下载JAR包
ivy.xml IVY的jar配置文件
ivysetttings.xml IVY的服务器地址等配置
rebel.xml 我用到的一个不用重启TOMCAT,可以重新加载class的工具的配置文件
其实主要的是build.properties,build.xml,ivy.xml,ivysettings.xml几个配置文件,内容分别如下,
ivy.settings.xml:
<ivysettings>
<settings defaultResolver="chained"/>
<resolvers>
<chain name="chained" returnFirst="true">
<filesystem name="libraries">
<artifact pattern="${ivy.conf.dir}/lib/[artifact]-[revision].[type]" />
</filesystem>
<url name="sillycat">
<artifact pattern="http://localhost:8081/nexus/content/groups/public/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<url name="sccl">
<artifact pattern="http://10.206.20.43:9999/nexus/content/groups/public/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
</chain>
</resolvers>
</ivysettings>
其中sillycat是本地私服,sccl是公司的私服,都使用的是原来maven2的nexus开源服务器。
ivy.xml是我们要管理和导入的jar包,这里只放了两个做个示例:
<ivy-module version="2.0">
<info organisation="sccl" module="swak" />
<configurations>
<conf name="release" />
</configurations>
<publications>
<artifact name="common" />
<artifact name="client" />
</publications>
<dependencies>
<!-- commons -->
<dependency org="commons-logging" name="commons-logging" rev="1.1.1"/>
<!-- spring jar -->
<dependency org="org/springframework" name="spring" rev="2.5.6"/>
</dependencies>
</ivy-module>
build.properties文件,里面配置的是build的一些信息:
app.name=ivysample
catalina.home=D:\eclipse-company\apache-tomcat-6.0.20
ant.encoding=GBK
java.level=1.5
另外就是重头戏了,ANT的build.xml文件
<project name="${app.name}" default="all" xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- some variables used -->
<property file="build.properties" />
<property name="app.name" value="${app.name}" />
<property name="src.dir" value="src" />
<property name="conf.dir" value="conf" />
<property name="build.dir" value="build" />
<property name="dist.dir" value="dist" />
<property name="web.dir" value="WebContent" />
<property name="lib.dir" value="${web.dir}/WEB-INF/lib" />
<property name="tomcat.dir" value="${catalina.home}" />
<property name="ivy.install.version" value="2.0.0" />
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<!-- paths used for compilation and run -->
<path id="compile.path.id">
<fileset dir="${tomcat.dir}\lib" />
<fileset dir="${lib.dir}" />
<path location="${build.dir}" />
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="${ivy.jar.file}" />
<target name="download-ivy">
<mkdir dir="${ivy.jar.dir}" />
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true" />
</target>
<!-- ================================= target: resolve ================================= -->
<target name="resolve" depends="download-ivy" description="--> retreive dependencies with ivy">
<ivy:retrieve pattern="${web.dir}/WEB-INF/lib/[artifact]-[revision].[ext]" />
</target>
<!-- ================================= target: clean-cache ================================= -->
<target name="clean-cache-lib" description="--> clean the ivy cache">
<delete dir="${ivy.home}/cache" />
</target>
<!-- ================================= target: clean ================================= -->
<target name="clean" description="--> clean the project">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<!-- ================================= target: prepare ================================= -->
<target name="prepare" description="--> make-dir build , dist">
<tstamp />
<mkdir dir="${build.dir}" />
<mkdir dir="${dist.dir}" />
<echo message="built at ${DSTAMP}-${TSTAMP}" />
<echo message="ant.version - ${ant.version}" />
<echo message="ant.java.version - ${ant.java.version}" />
<echo message="ivy.cache.dir - ${ivy.home}/cache"/>
</target>
<!-- ================================= target: compile ================================= -->
<target name="compile" depends="prepare" description="--> Compile Java sources">
<!-- Compile Java classes as necessary -->
<property name="compile.java.encoding" value="${ant.encoding}" />
<mkdir dir="${build.dir}/WEB-INF/classes" />
<javac srcdir="${src.dir}" destdir="${build.dir}/WEB-INF/classes" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" encoding="${ant.encoding}" source="${java.level}">
<classpath refid="compile.path.id" />
</javac>
<copy todir="${build.dir}/WEB-INF/classes">
<fileset dir="${src.dir}">
<include name="**/*.xml"/>
<include name="**/*.txt"/>
<include name="**/*.properties"/>
<exclude name="config.properties"/>
<exclude name="log4j.properties"/>
</fileset>
</copy>
</target>
<!-- ================================= target: javadoc ================================= -->
<target name="javadoc" depends="compile" description="-->Create Javadoc API documentation">
<mkdir dir="${dist.dir}/api-docs" />
<javadoc sourcepath="${src.dir}" destdir="${dist.dir}/api-docs" packagenames="*">
<classpath refid="compile.path.id" />
</javadoc>
</target>
<target name="copyWeb">
<copy todir="${build.dir}">
<fileset dir="${web.dir}">
<exclude name="WEB-INF/classes/**"/>
</fileset>
</copy>
</target>
<target name="war" depends="clean,compile,copyWeb" description="--> build web application war package">
<war destfile="${dist.dir}/${app.name}.war" webxml="${build.dir}/WEB-INF/web.xml">
<fileset dir="${build.dir}"/>
</war>
<copy tofile="${dist.dir}/config.properties" file="${conf.dir}/config.properties"/>
<copy tofile="${dist.dir}/log4j.properties" file="${conf.dir}/log4j.properties"/>
</target>
<target name="all" depends="war,javadoc" description="clean, build jar package, generate api- doc">
</target>
</project>
配置就完成了,运行以下ANT命令就行了
ant war 打war包
ant resolve 准备jar包
ant clean-cache-lib 将jar包的本地cache清空,以得到相同版本号刷新版本jar
发表评论
-
Update Site will come soon
2021-06-02 04:10 1618I am still keep notes my tech n ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 383Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 381Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 337Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 405VPN Server 2020(2)Docker on Cen ... -
Nginx Deal with OPTIONS in HTTP Protocol
2020-02-15 01:33 306Nginx Deal with OPTIONS in HTTP ... -
PDF to HTML 2020(1)pdftohtml Linux tool or PDFBox
2020-01-29 07:37 348PDF to HTML 2020(1)pdftohtml Li ... -
Elasticsearch Cluster 2019(2)Kibana Issue or Upgrade
2020-01-12 03:25 605Elasticsearch Cluster 2019(2)Ki ... -
Spark Streaming 2020(1)Investigation
2020-01-08 07:19 235Spark Streaming 2020(1)Investig ... -
Hadoop Docker 2019 Version 3.2.1
2019-12-10 07:39 260Hadoop Docker 2019 Version 3.2. ... -
MongoDB 2019(3)Security and Auth
2019-11-16 06:48 207MongoDB 2019(3)Security and Aut ... -
MongoDB 2019(1)Install 4.2.1 Single and Cluster
2019-11-11 05:07 254MongoDB 2019(1) Follow this ht ... -
Monitor Tool 2019(1)Monit Installation and Usage
2019-10-17 08:22 290Monitor Tool 2019(1)Monit Insta ... -
Ansible 2019(1)Introduction and Installation on Ubuntu and CentOS
2019-10-12 06:15 275Ansible 2019(1)Introduction and ... -
Timezone and Time on All Servers and Docker Containers
2019-10-10 11:18 294Timezone and Time on All Server ... -
Kafka Cluster 2019(6) 3 Nodes Cluster on CentOS7
2019-10-05 23:28 242Kafka Cluster 2019(6) 3 Nodes C ... -
K8S Helm(1)Understand YAML and Kubectl Pod and Deployment
2019-10-01 01:21 292K8S Helm(1)Understand YAML and ... -
Rancher and k8s 2019(5)Private Registry
2019-09-27 03:25 330Rancher and k8s 2019(5)Private ... -
Jenkins 2019 Cluster(1)Version 2.194
2019-09-12 02:53 408Jenkins 2019 Cluster(1)Version ... -
Redis Cluster 2019(3)Redis Cluster on CentOS
2019-08-17 04:07 339Redis Cluster 2019(3)Redis Clus ...
相关推荐
项目中jar包管理工具,使得jar包可以以配置文件的形式管理,避免两个工程对相同jar包的重复使用
ant 构建所需要的jar包,用于jasper report的项目,因项目中需要依赖一些外部jar包,所以必须要用构建工具,ivy是构建所必须的工具包。
必须注意对于不同的hadoop版本,` HADDOP_INSTALL_PATH/share/hadoop/common/lib`下的jar包版本都不同,需要一个个调整 - `hadoop2x-eclipse-plugin-master/ivy/library.properties` - `hadoop2x-eclipse-plugin-...
赠送jar包:ivy-2.4.0.jar; 赠送原API文档:ivy-2.4.0-javadoc.jar; 赠送源代码:ivy-2.4.0-sources.jar; 赠送Maven依赖信息文件:ivy-2.4.0.pom; 包含翻译后的API文档:ivy-2.4.0-javadoc-API文档-中文(简体)版...
ivy-2.3.0.jar包,我编译eclipse hadoop插件用到的
eclipse安装配置Ivy、Ivyde插件--亲测成功,内附说明、截图、安装包 傻瓜式安装!!!
SBT ivy2 scala构建工具jar包 scala 构建工具 sbt
ivy-2.1.0.jar包,我编译eclipse hadoop插件用到的
ivy-2.5.0.jar
ivy 1 4 1 jar 好难找啊
eclipse安装ivy和ivyde插件方法,内附安装过程和相应的ivy,ivyde插件安装包
赠送jar包:ivy-2.4.0.jar; 赠送原API文档:ivy-2.4.0-javadoc.jar; 赠送源代码:ivy-2.4.0-sources.jar; 赠送Maven依赖信息文件:ivy-2.4.0.pom; 包含翻译后的API文档:ivy-2.4.0-javadoc-API文档-中文(简体)-...
org.apache.ivy.eclipse.ant_2.4.0.final_20141213170938.jar
NULL 博文链接:https://wuquanyin1011.iteye.com/blog/688167
${hadoop.root}/build/ivy/lib/Hadoop/common/commons-cli-${commons-cli.version}.jar" todir="${build.dir}/lib" verbose="true"/> 改成 ${hadoop.root}/hadoop-core-${version}.jar" tofile="${build.dir}/lib/...
中文-英文对照文档,中英对照文档,java,jar包,Maven,第三方jar包,组件,开源组件,第三方组件,Gradle,中文API文档,手册,开发手册,使用手册,参考手册 # 使用方法: 解压 【***.jar中文文档.zip】,再解压其中的 【***-...
目前包含jar列表如下: ant-1.9.3.jar ant-launcher-1.9.3.jar asm-all-5.0.3.jar bcpg-jdk15on-1.51.jar bcprov-jdk15on-1.51.jar bndlib-2.1.0.jar bsh-2.0b4.jar commons-beanutils-1.7.0.jar commons-...
这是自己本机编译的JMeterAMQP.jar,放置位置为 jmeter安装目录中的lib/ext中,可用于测试rabbitmq等 以下为自己的编译方法: 源码地址:https://github.com/jlavallee/JMeter-Rabbit-AMQP 环境需求:jdk 1.8,...