maven

Spring Boot 2.4 示例创建 POM 文件

非 Y 不嫁゛ 提交于 2021-01-09 02:07:11
我们需要从创建一个 Maven pom.xml 文件开始整个过程。 与我们做饭一样,Maven pom.xml 文件就好像一个菜单,我们需要使用这个来构建你的项目。 打开你常用的文本编辑器,然后将下面的内容拷贝到 pom.xml 文件中。 <?xml version="1.0" encoding="UTF-8"?> < project xmlns = "http://maven.apache.org/POM/4.0.0" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" > < modelVersion > 4.0.0 </ modelVersion > < groupId > com.example </ groupId > < artifactId > myproject </ artifactId > < version > 0.0.1-SNAPSHOT </ version > < parent > < groupId > org.springframework.boot </ groupId > <

maven私服nexus搭建

℡╲_俬逩灬. 提交于 2021-01-09 00:52:20
下载nexus安装包,当前使用2.3.1版本。解压后有两个文件夹 nexus-2.3.1-01 、 sonatype-work 添加环境变量,路径为: D:\nexus-2.3.1-01-bundle\nexus-2.3.1-01\bin ,前面的路径根据自己的情况进行修改 检查环境变量是否生效,进入cmd运行 nexus 命令,出现如下情况标识成功: 安装服务。 方式1:在nexus目录下运行bat文件:D:\nexus-2.3.1-01-bundle\nexus-2.3.1-01\bin\jsw\windows-x86-64\install-nexus.bat。 前面的'windows-x86-64'为当前机器环境,推荐方式2. 方式2:在cmd中直接运行命令:nexus install。 此过程中可能遇到提示错误 wrapper | OpenSCManager failed - 拒绝访问。 (0x5) ,需要使用管理员身份运行cmd命令。安装完成后在系统服务中可以看到新增了nexus的服务项 启动服务。 方式1:在nexus目录下运行bat文件:D:\nexus-2.3.1-01-bundle\nexus-2.3.1-01\bin\jsw\windows-x86-64\start-nexus.bat。 前面的'windows-x86-64'为当前机器环境,推荐方式2. 方式2

maven nexus 私服搭建 Windows版

自作多情 提交于 2021-01-08 22:59:53
准备工作 已安装jdk,并配置好了环境变量 已安装maven,并配置好了环境变量 下载Nexus Repository OSS: https://www.sonatype.com/download-oss-sonatype 如果无法下载成功,可访问百度网盘: Linux版链接: https://pan.baidu.com/s/1OYTfIfEuIQgD4QDH2d5LLA ,提取码:whwh Windows版链接: https://pan.baidu.com/s/12yfQ4M5bk2G-v-2idLiumA ,提取码:0hx5 验证JDK和MAVEN java - version mvn -v 解压Nexus安装包 将nexus-3.17.01-win64.zip解压到D:\Program Files (x86)\nexus3文件夹下 解压后 查看运行端口 查看D:\Program Files (x86)\nexus3\nexus-3.17.0-01\etc\nexus-default.properties文件中的运行端口 安装为Windows服务 以管理员身份运行cmd 进入nexus3安装目录的bin目录下,通过nexus.exe /install nexus3 命令,安装为名为nexus3的Windows服务 启动、关闭、重启服务 启动服务方式有两种种: 1

基于maven2打包不同jdk版本的包

不想你离开。 提交于 2021-01-08 08:37:40
通常在一些特别情况下,我们需要为单独某一个构件打包多个不同jdk版本的包,用来支持不同的jdk,基于maven我们就可以很方便的做到这点。 1、在项目的pom文件中加入如下配置 <project xmlns = "http://maven.apache.org/POM/4.0.0" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" > <modelVersion> 4.0.0 </modelVersion> <groupId> cc.mzone </groupId> <artifactId> blog </artifactId> <packaging> jar </packaging> <version> 0.1 </version> <url> http://www.mzone.cc </url> <build> <plugins> <plugin> <artifactId> maven-compiler-plugin </artifactId> <version> 2.0.2 </version>

搭建基于Nexus 3的npm私服

风流意气都作罢 提交于 2021-01-07 23:49:32
创建Repository Nexus Repository Manager 3 可以用于多种类型的包管理。 因工作需要,需要配置基于Nexus 3的npm包管理。 Nexus默认账号: admin/admin123 选择配置页面 选择左侧的Repositories 点击Create repository功能 这样就会看到Nexus 3支持的repository类型。对于Java开发者maven2的应该就很熟悉了。 仔细观察会发现,每一种repository都包含三种类型可以创建, group, hosted,proxy。下面分别对每种做说明: proxy 根据proxy名字,就可以想象的出这种类型的repository是用来坐代理的。比如我们在建Maven私服,需要和中央库连通,此时就需要用proxy来创建repository。见Nexus模式的maven-central库。 hosted 这种repository可以简单的理解为用于私有的,内部的repository。我们工作中开发的一些工具,组件库等不方便放到中央库,但是却又需要在公司内部共享,就需要创建hosted类型的repository,用于发布公司内部的组件。见maven-releases, maven-snapshots。 group 最后来说说group类型。其实这种类型是一种虚拟的repository

如何使用Spring RetryTemplate

人走茶凉 提交于 2021-01-07 23:03:24
在云计算场景中,网络是其中的一个重要部分。实际情况下的网络环境没有开发环境的网络那么稳定,所以在云计算中,网络是不可靠的已经成为了一条默认的潜规则。在系统研发的过程中,满足正常的业务需求的必要前提下,系统的鲁棒性,容错性也成为了一个重要的技术需求。 在网络不可靠的环境中,要保证业务流程,就需要在网络异常时对流程异常环节进行重试处理。 Spring框架为我们提供了重试机制,接下来我们来试验下Spring的重试。 Maven Dependency 假设项目是Maven管理的,需要在家pom中增加spring-retry包的依赖。 < dependency > < groupId > org.springframework.retry </ groupId > < artifactId > spring-retry </ artifactId > </ dependency > 创建Spring Retry Template 创建一个Bean配置类来管理bean,使用@EnableRetry来启用Spring重试,通过@Bean注解创建一个RetryTemplate加入Spring Container。配置最大重试次数为4。 @Configuration @EnableRetry public class BeanSeederServices { @Bean public

搭建基于Nexus 3的npm私服

牧云@^-^@ 提交于 2021-01-07 14:53:01
创建Repository Nexus Repository Manager 3 可以用于多种类型的包管理。 因工作需要,需要配置基于Nexus 3的npm包管理。 Nexus默认账号: admin/admin123 选择配置页面 选择左侧的Repositories 点击Create repository功能 这样就会看到Nexus 3支持的repository类型。对于Java开发者maven2的应该就很熟悉了。 仔细观察会发现,每一种repository都包含三种类型可以创建, group, hosted,proxy。下面分别对每种做说明: proxy 根据proxy名字,就可以想象的出这种类型的repository是用来坐代理的。比如我们在建Maven私服,需要和中央库连通,此时就需要用proxy来创建repository。见Nexus模式的maven-central库。 hosted 这种repository可以简单的理解为用于私有的,内部的repository。我们工作中开发的一些工具,组件库等不方便放到中央库,但是却又需要在公司内部共享,就需要创建hosted类型的repository,用于发布公司内部的组件。见maven-releases, maven-snapshots。 group 最后来说说group类型。其实这种类型是一种虚拟的repository

dubbo实现示例

爱⌒轻易说出口 提交于 2021-01-07 08:00:37
创建 MAVEN项目 项目结构: 在项目 pom.xml中添加依赖 <dependency> <groupId>org.apache.zookeeper</groupId> <artifactId>zookeeper</artifactId> <version>3.4.9</version> </dependency> <!-- dubbo --> <dependency> <groupId>com.alibaba</groupId> <artifactId>dubbo</artifactId> <version>2.5.3</version> <exclusions> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>com.101tec</groupId> <artifactId>zkclient</artifactId> <version>0.10</version> </dependency> 主要分三大模块: dubbo-api : 存放公共接口; dubbo-consumer : 调用远程服务; dubbo-provider :

idea搭建可运行Servlet的Web项目[maven]

限于喜欢 提交于 2021-01-07 08:00:11
1. new Project File > new > Project… 2. 填写 GroupID\ArtifactID GroupID 是项目组织唯一的标识符,实际对应JAVA的包的结构,是main目录里java的目录结构。 ArtifactID 是项目的唯一的标识符,实际对应项目的名称,就是项目根目录的名称。 接下来一路 Next 然后 Finish 完成创建。 创建完成后如下图所示: 3. 创建 java 目录 在 main 目录上右击,选择 New Folder 将 java 目录标记为 Source 同样的我们可以再来创建一个 resource 文件夹,标记为 resource 类型: 完成之后: 4. 创建 Servlet 首先引入 Servlet 需要的依赖: < dependency > < groupId > javax.servlet </ groupId > < artifactId > servlet-api </ artifactId > < version > 2.5 </ version > </ dependency > 编写 MyServlet 继承 HttpServle t 实现 service 方法: public class MyServlet extends HttpServlet { @Override protected void