热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Spring-bootweb工程构建,并把maven子项目模块依赖jar打包,笔记

1.对于maven构建spring-bootweb工程。pom.xml<?xmlversion1.0?><projectxsi:schemaLocation

1.对于maven构建spring-boot web工程。pom.xml


<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<modelVersion>4.0.0modelVersion>
<parent>
<groupId>cn.gitv.bigroupId>
<artifactId>hadoopartifactId>
<version>1.0-SNAPSHOTversion>
parent>

<artifactId>hadoop-internal-apiartifactId>
<name>hadoop-internal-apiname>



<properties>
<project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
<maven.compiler.target>1.7maven.compiler.target>
<maven.compiler.source>1.7maven.compiler.source>
properties>

<build>
<finalName>hadoop-internal-api-${project.version}finalName>
<plugins>

<plugin>


<groupId>org.apache.maven.pluginsgroupId>
<artifactId>maven-assembly-pluginartifactId>
<version>2.3version>
<configuration>
<appendAssemblyId>trueappendAssemblyId>
<descriptors>
<descriptor>assembly.xmldescriptor>
descriptors>




configuration>
<executions>
<execution>
<id>make-assemblyid>
<phase>packagephase>
<goals>
<goal>singlegoal>
goals>
execution>
executions>
plugin>

plugins>

build>


<dependencies>


<dependency>
<groupId>junitgroupId>
<artifactId>junitartifactId>
<scope>testscope>
dependency>


<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-webartifactId>
dependency>
<dependency>
<groupId>cn.gitv.bigroupId>
<artifactId>hadoop-hbase-daoartifactId>
<version>1.0-SNAPSHOTversion>
dependency>
<dependency>
<groupId>cn.gitv.bigroupId>
<artifactId>hadoop-commonartifactId>
<version>1.0-SNAPSHOTversion>
dependency>
dependencies>

project>
  1. assembly.xml
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">




<id>binid>
<formats>
<format>tar.gzformat>
formats>
<fileSets>
<fileSet>
<directory>${project.basedir}directory>
<outputDirectory>/outputDirectory>
<includes>
<include>README*include>
<include>LICENSE*include>
<include>NOTICE*include>
includes>
fileSet>



<fileSet>
<directory>src/main/resources/scriptsdirectory>
<outputDirectory>binoutputDirectory>
fileSet>
fileSets>

<dependencySets>
<dependencySet>
<outputDirectory>/outputDirectory>
<useProjectArtifact>trueuseProjectArtifact>
dependencySet>
dependencySets>
assembly>
  1. 运行脚本 run.sh
#!/bin/bash
SCRIPT_HOME=$(dirname $(readlink -f $0))
bash -ex $SCRIPT_HOME/startup.sh 9000

4.startup.sh

#!/bin/bash

JAVA_OPTS="-server -Xms1024m -Xmx1024m -Xmn384m -XX:MaxPermSize=64m \
-Xss256k -XX:+UseConcMarkSweepGC \
-XX:+UseParNewGC -XX:CMSFullGCsBeforeCompaction=5 \
-XX:+UseCMSCompactAtFullCollection \
-XX:+PrintGC -Xloggc:/data/bi/hadoop-internal-api/logs/gc.log"


PHOME=$(dirname `readlink -f "$0"`)
PHOME=$(dirname $PHOME)

pid=`ps -eo pid,args | grep hadoop-internal-api | grep 9000 | grep java | grep -v grep | awk '{print $1}'`
if [ -n "$pid" ]
then
kill -3 ${pid}
kill ${pid} && sleep 3
if [ -n "`ps -eo pid | grep $pid`" ]
then
kill -9 ${pid}
fi
echo "kill pid: ${pid}"
fi

java $JAVA_OPTS -cp $PHOME/conf:$PHOME/lib/* cn.gitv.bi.internal.api.Application $1 > /dev/null 2>&1 &

注意:如果是从windows写的脚本放到linux上

由于windows下对文本文件的保存格式与unix下不同造成的,windows下回车的字符是’\r\n’,而linux下是’\n’。

head -1 run.sh |od -c
可以看到

需要运行命令转换格式

dos2unix run.sh
dos2unix startup.sh

推荐阅读
  • 本文详细介绍了Java中org.neo4j.helpers.collection.Iterators.single()方法的功能、使用场景及代码示例,帮助开发者更好地理解和应用该方法。 ... [详细]
  • Explore how Matterverse is redefining the metaverse experience, creating immersive and meaningful virtual environments that foster genuine connections and economic opportunities. ... [详细]
  • Explore a common issue encountered when implementing an OAuth 1.0a API, specifically the inability to encode null objects and how to resolve it. ... [详细]
  • 本文详细介绍了Java中org.eclipse.ui.forms.widgets.ExpandableComposite类的addExpansionListener()方法,并提供了多个实际代码示例,帮助开发者更好地理解和使用该方法。这些示例来源于多个知名开源项目,具有很高的参考价值。 ... [详细]
  • 深入解析 Apache Shiro 安全框架架构
    本文详细介绍了 Apache Shiro,一个强大且灵活的开源安全框架。Shiro 专注于简化身份验证、授权、会话管理和加密等复杂的安全操作,使开发者能够更轻松地保护应用程序。其核心目标是提供易于使用和理解的API,同时确保高度的安全性和灵活性。 ... [详细]
  • 技术分享:从动态网站提取站点密钥的解决方案
    本文探讨了如何从动态网站中提取站点密钥,特别是针对验证码(reCAPTCHA)的处理方法。通过结合Selenium和requests库,提供了详细的代码示例和优化建议。 ... [详细]
  • 本文详细介绍了Java编程语言中的核心概念和常见面试问题,包括集合类、数据结构、线程处理、Java虚拟机(JVM)、HTTP协议以及Git操作等方面的内容。通过深入分析每个主题,帮助读者更好地理解Java的关键特性和最佳实践。 ... [详细]
  • 本文详细介绍了Java中org.w3c.dom.Text类的splitText()方法,通过多个代码示例展示了其实际应用。该方法用于将文本节点在指定位置拆分为两个节点,并保持在文档树中。 ... [详细]
  • 深入解析 Spring Security 用户认证机制
    本文将详细介绍 Spring Security 中用户登录认证的核心流程,重点分析 AbstractAuthenticationProcessingFilter 和 AuthenticationManager 的工作原理。通过理解这些组件的实现,读者可以更好地掌握 Spring Security 的认证机制。 ... [详细]
  • 深入理解Cookie与Session会话管理
    本文详细介绍了如何通过HTTP响应和请求处理浏览器的Cookie信息,以及如何创建、设置和管理Cookie。同时探讨了会话跟踪技术中的Session机制,解释其原理及应用场景。 ... [详细]
  • ImmutableX Poised to Pioneer Web3 Gaming Revolution
    ImmutableX is set to spearhead the evolution of Web3 gaming, with its innovative technologies and strategic partnerships driving significant advancements in the industry. ... [详细]
  • RecyclerView初步学习(一)
    RecyclerView初步学习(一)ReCyclerView提供了一种插件式的编程模式,除了提供ViewHolder缓存模式,还可以自定义动画,分割符,布局样式,相比于传统的ListVi ... [详细]
  • 本文详细介绍了 Apache Jena 库中的 Txn.executeWrite 方法,通过多个实际代码示例展示了其在不同场景下的应用,帮助开发者更好地理解和使用该方法。 ... [详细]
  • 在使用 MUI 框架进行应用开发时,开发者常常会遇到 mui.init() 和 mui.plusReady() 这两个方法。本文将详细解释它们的区别及其在不同开发环境下的应用。 ... [详细]
  • 题目Link题目学习link1题目学习link2题目学习link3%%%受益匪浅!-----&# ... [详细]
author-avatar
正在减肥的小小_519
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有