详细解释 集成Maven Spring Mybatis项目包生成Bat文件
有时在项目必须Maven项目包生成bat文件,长官一人。本文将解释的具体使用方法maven-assembly-plugin插件实现bat文件包。
1.首先看一下项目结构
2.配置pom.xml文件,在节点build中增加下面配置内容
<span style="font-family:KaiTi_GB2312;font-size:18px;"><resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>src/main/resources/bin</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources/bin</directory>
<filtering>true</filtering>
<targetPath>bin</targetPath>
</resource>
</resources> <plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.uih.anyi.mnis.drugbag.service.main.TestMain</mainClass>
<addClasspath>true</addClasspath>
<classpathPrefix>${lib.output.dir}</classpathPrefix>
<useUniqueVersions>false</useUniqueVersions>
</manifest>
<manifestEntries>
<Class-Path>.</Class-Path>
</manifestEntries>
</archive>
<excludes>
<exclude>properties/</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
</build></span>
2.assembly.xml文件内容
<span style="font-family:KaiTi_GB2312;font-size:18px;"><assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>distribution</id>
<formats>
<format>zip</format>
</formats>
<files>
<file>
<source>${project.build.directory}/${project.build.finalName}.jar</source>
<outputDirectory>/</outputDirectory>
</file>
</files>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>README*</include>
<include>LICENSE*</include>
<include>NOTICE*</include>
</includes>
</fileSet>
<!-- 相应src/java/resources/相关文件 -->
<fileSet>
<directory>${project.build.outputDirectory}/bin/</directory>
<outputDirectory>/bin/</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.build.outputDirectory}/properties/</directory>
<outputDirectory>/properties/</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.build.outputDirectory}/db/</directory>
<outputDirectory>/db/</outputDirectory>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/${lib.output.dir}</outputDirectory>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
</assembly></span>
3.编写bat批处理文件
<span style="font-family:KaiTi_GB2312;font-size:18px;">@title Lachesis Synchronous_DrugBagRec_Datas %1 @echo %~dp0
echo off
rem Guess MNIS_HOME if not defined
set "CURRENT_DIR=%cd%"
if not "%MNIS_HOME%" == "" goto gotHome
set "MNIS_HOME=%CURRENT_DIR%"
if exist "%MNIS_HOME%\bin\run_midware.bat" goto okHome
set "MNIS_HOME=%~dp0.."
cd "%CURRENT_DIR%" :gotHome
if exist "%MNIS_HOME%\bin\run_midware.bat" goto okHome
echo The MNIS_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end :okHome
if "%1" == "" goto startup :startup
@set classpath=%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;%MNIS_HOME%\lib;
java -Xms32m -Xmx128m -XX:MaxNewSize=32m -XX:MaxPermSize=128m -jar %MNIS_HOME%\${project.build.finalName}.${project.packaging} %1 & echo on
:end
pause</span>
4.选择项目,运行Maven Install
在target下会生成zip包。解压后,执行bin下的bat文件,就能够执行了。
版权声明:本文博客原创文章,博客,未经同意,不得转载。
详细解释 集成Maven Spring Mybatis项目包生成Bat文件的更多相关文章
- 用 Eclipse 搭建一个简单的 Maven spring mybatis 项目(包含测试用例)
1: 先搭建一个Maven项目: 创建好后的目录: 2: 配置pom.xml文件: <project xmlns="http://maven.apache.org/POM/4.0.0& ...
- idea 创建的maven+spring+mybatis项目整合 报错无法创建bean
报错如下: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with n ...
- mybatis学习笔记(五) -- maven+spring+mybatis从零开始搭建整合详细过程(附demo和搭建过程遇到的问题解决方法)
文章介绍结构一览 一.使用maven创建web项目 1.新建maven项目 2.修改jre版本 3.修改Project Facts,生成WebContent文件夾 4.将WebContent下的两个文 ...
- mybatis学习笔记(六) -- maven+spring+mybatis从零开始搭建整合详细过程(下)
继续 mybatis学习笔记(五) -- maven+spring+mybatis从零开始搭建整合详细过程(上) 五.使用监听器启动Spring容器 1.修改pom.xml文件,添加Spring-we ...
- maven,spring,mybatis集成错误
maven,spring,mybatis集成的时候单元测试junit测试没问题,但mvn jetty:run 就报错误 错误: org.apache.ibatis.binding.BindingExc ...
- maven spring mybatis配置注意点
以下对使用maven配置spring+mybatis项目时,完成基本的配置需要添加的一些信息进行说明.仅对mybatis部分进行列举. maven添加mybatis支持 <!-- mybatis ...
- 用Eclipse 搭建一个Maven Spring SpringMVC 项目
1: 先创建一个maven web 项目: 可以参照之前的文章: 用Maven 创建一个 简单的 JavaWeb 项目 创建好之后的目录是这样的; 2: 先配置maven 修改pom.xml & ...
- IntelliJ IDEA上创建maven Spring MVC项目
IntelliJ IDEA上创建Maven Spring MVC项目 各软件版本 利用maven骨架建立一个webapp 建立相应的目录 配置Maven和SpringMVC 配置Maven的pom.x ...
- maven Spring MVC项目
IntelliJ IDEA上创建maven Spring MVC项目 各软件版本 利用maven骨架建立一个webapp 建立相应的目录 配置Maven和SpringMVC 配置Maven的pom.x ...
随机推荐
- 【源代码】TreeMap源代码剖析
注:下面源代码基于jdk1.7.0_11 之前介绍了一系列Map集合中的详细实现类,包含HashMap,HashTable,LinkedHashMap.这三个类都是基于哈希表实现的,今天我们介绍还有一 ...
- iOS开展——全球应对MotionEvent
遇到这样的要求:无论在哪个应用程序view controller,摇动手机,我们可以启动的方法. 你可以认为这个想法是使用包装的苹果"MotionEvent".但是,假如简单地把代 ...
- JSP中的include有哪些?有什么差别?
JSP中的include有哪些?有什么差别? 1.JSP中的include有哪些 (1)<%@include file="" %> (2)<jsp:include ...
- DICOM医学图像处理:开源库mDCM与DCMTK的比較分析(一),JPEG无损压缩DCM图像
背景介绍: 近期项目需求,须要使用C#进行最新的UI和相关DICOM3.0医学图像模块的开发.在C++语言下,我使用的是应用最广泛的DCMTK开源库,在本专栏的起初阶段的大多数博文都是对DCMTK开源 ...
- 【最小割】HDU 4971 A simple brute force problem.
说是最大权闭合图.... 比赛时没敢写.... 题意 一共同拥有n个任务,m个技术 完毕一个任务可盈利一些钱,学习一个技术要花费钱 完毕某个任务前须要先学习某几个技术 可是可能在学习一个任务前须要学习 ...
- Mongodb 之insert瞬时完成,测试数据---飞天博客
这几天看mongdb官方网站,然后将执行数据.突然,我发现,该数据确实很强大,在这里说话数据.我用普通的pc机,amd双核 2.7GHz,4G内存,当然,当系统不只是在测试作为数据库server的.同 ...
- Python 获取Twitter用户与Friends和Followers的关系(eg, 交集,差集)
CODE: #!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on 2014-7-30 @author: guaguastd @name: f ...
- 建立ORACLE10G DATA GUARD--->Physical Standby
下面是我自己建Physical Standby,按照下面的步骤一步我一步,当然,打造成功,以下步骤可以作为建筑物Data Guard结构操作手册. HA和DG差额:HA:可以做IP切换自己主动 DG ...
- Cordova WP8 平台安装部署
原文:Cordova WP8 平台安装部署 Cordova是一个开放源码移动开发框架. 它允许您使用标准的 web 技术如 HTML5. CSS3 和 JavaScript 进行跨平台开发,避免每个移 ...
- poj 1274The Perfect Stall
第一次接触二分图匹配. 这题是一个匈牙利算法的模板题直接套即可. 题意是 给你奶牛和谷仓的个数a和b,接下来a行是奶牛喜欢去的谷仓.第一个是谷仓个数,接下来是谷仓编号. 这里我们把行当奶牛,列当谷仓 ...