<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>maven &#8211; Lhy&#039;s blog</title>
	<atom:link href="https://blog.lhyshome.com/tag/maven/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.lhyshome.com</link>
	<description>welcome</description>
	<lastBuildDate>Thu, 30 May 2024 02:47:11 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
<site xmlns="com-wordpress:feed-additions:1">219834889</site>	<item>
		<title>ruoyi微服务后端集成mybatis-plus 3.5.6</title>
		<link>https://blog.lhyshome.com/2024/05/30/152/</link>
					<comments>https://blog.lhyshome.com/2024/05/30/152/#respond</comments>
		
		<dc:creator><![CDATA[lhy]]></dc:creator>
		<pubDate>Thu, 30 May 2024 02:36:44 +0000</pubDate>
				<category><![CDATA[java]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[mybatis]]></category>
		<category><![CDATA[mybatis-plus]]></category>
		<category><![CDATA[ruoyi]]></category>
		<guid isPermaLink="false">https://blog.lhyshome.com/?p=152</guid>

					<description><![CDATA[父类pom和公共pom依赖修改 ruoyi-parent pom.xml中添加 将properties下 &#038;l… <span class="read-more"><a href="https://blog.lhyshome.com/2024/05/30/152/">Read More &#187;</a></span>]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">父类pom和公共pom依赖修改</h2>



<h3 class="wp-block-heading">ruoyi-parent</h3>



<p>pom.xml中添加</p>



<pre class="wp-block-code"><code>&lt;project>
    &lt;properties>
        &lt;mybatis-starter.version>2.3.1&lt;/mybatis-starter.version>
        &lt;mybatis-plus.version>3.5.6&lt;/mybatis-plus.version>
    &lt;/properties>
&lt;/project></code></pre>



<p>将properties下</p>



<pre class="wp-block-preformatted">&lt;ruoyi.version>3.6.4&lt;/ruoyi.version>改为<br>&lt;ruoyi.version>${project.version}&lt;/ruoyi.version></pre>



<p>将&lt;version>3.6.4&lt;/version>升级为&lt;version>3.6.4.1&lt;/version></p>



<p>执行maven deploy</p>



<h3 class="wp-block-heading">ruoyi-common</h3>



<p>在ruoyi-common-core模块pom.xml中</p>



<p>pagehelper-spring-boot-starter包中排除mybatis-spring-boot-starter</p>



<pre class="wp-block-code"><code>        &lt;dependency>
            &lt;groupId>com.github.pagehelper&lt;/groupId>
            &lt;artifactId>pagehelper-spring-boot-starter&lt;/artifactId>
            &lt;exclusions>
                &lt;exclusion>
                    &lt;groupId>org.mybatis.spring.boot&lt;/groupId>
                    &lt;artifactId>mybatis-spring-boot-starter&lt;/artifactId>
                &lt;/exclusion>
            &lt;/exclusions>
        &lt;/dependency></code></pre>



<p>添加以下包的引用</p>



<pre class="wp-block-code"><code>&lt;dependency>
    &lt;groupId>org.mybatis.spring.boot&lt;/groupId>
    &lt;artifactId>mybatis-spring-boot-autoconfigure&lt;/artifactId>
    &lt;version>${mybatis-starter.version}&lt;/version>
&lt;/dependency>

&lt;dependency>
    &lt;groupId>com.baomidou&lt;/groupId>
    &lt;artifactId>mybatis-plus-boot-starter&lt;/artifactId>
    &lt;version>${mybatis-plus.version}&lt;/version>
&lt;/dependency>

&lt;dependency>
    &lt;groupId>com.baomidou&lt;/groupId>
    &lt;artifactId>mybatis-plus-extension&lt;/artifactId>
    &lt;version>${mybatis-plus.version}&lt;/version>
    &lt;scope>compile&lt;/scope>
&lt;/dependency></code></pre>



<p>com.ruoyi.common.core.config下添加mybatis-plus配置</p>



<pre class="wp-block-code"><code>package com.ruoyi.common.core.config;<br><br>import com.baomidou.mybatisplus.annotation.DbType;<br>import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;<br>import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor;<br>import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;<br>import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;<br>import org.springframework.context.annotation.Bean;<br>import org.springframework.context.annotation.Configuration;<br>import org.springframework.transaction.annotation.EnableTransactionManagement;<br><br><em>/**<br></em><em> * Mybatis Plus </em><em>配置<br></em><em> </em><em>*<br></em><em> * </em><em>@author </em><em>ruoyi<br></em><em> */<br></em>@EnableTransactionManagement(proxyTargetClass = true)<br>@Configuration<br>public class MybatisPlusConfig {<br><br>    @Bean<br>    public MybatisPlusInterceptor mybatisPlusInterceptor() {<br>        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();<br>        // 分页插件<br>        interceptor.addInnerInterceptor(paginationInnerInterceptor());<br>        // 乐观锁插件<br>        interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor());<br>        // 阻断插件<br>        interceptor.addInnerInterceptor(blockAttackInnerInterceptor());<br>        return interceptor;<br>    }<br><br>    <em>/**<br></em><em>     * </em><em>分页插件，自动识别数据库类型 </em><em>https://baomidou.com/guide/interceptor-pagination.html<br></em><em>     */<br></em><em>    </em>public PaginationInnerInterceptor paginationInnerInterceptor() {<br>        PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();<br>        // 设置数据库类型为mysql<br>        paginationInnerInterceptor.setDbType(DbType.<em>MYSQL</em>);<br>        // 设置最大单页限制数量，默认 500 条，-1 不受限制<br>        paginationInnerInterceptor.setMaxLimit(-1L);<br>        return paginationInnerInterceptor;<br>    }<br><br>    <em>/**<br></em><em>     * </em><em>乐观锁插件 </em><em>https://baomidou.com/guide/interceptor-optimistic-locker.html<br></em><em>     */<br></em><em>    </em>public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor() {<br>        return new OptimisticLockerInnerInterceptor();<br>    }<br><br>    <em>/**<br></em><em>     * </em><em>如果是对全表的删除或更新操作，就会终止该操作 </em><em>https://baomidou.com/guide/interceptor-block-attack.html<br></em><em>     */<br></em><em>    </em>public BlockAttackInnerInterceptor blockAttackInnerInterceptor() {<br>        return new BlockAttackInnerInterceptor();<br>    }<br>}</code></pre>



<p>将全局pom.xml的版本&lt;version>3.6.4&lt;/version>升级为&lt;version>3.6.4.1&lt;/version></p>



<p>执行maven deploy</p>



<h3 class="wp-block-heading">ruoyi-api</h3>



<p>将全局pom.xml的版本&lt;version>3.6.4&lt;/version>升级为&lt;version>3.6.4.1&lt;/version></p>



<p>执行maven deploy</p>



<h3 class="wp-block-heading">ps：</h3>



<p>因为ruoyi-common中ruoyi-common-security模块依赖了ruoyi-api-system，所以也需要升级ruoyi-api和ruoyi-api-system</p>



<p>但是ruoyi-api-system又依赖了ruoyi-common-core</p>



<p>所以执行顺序是：</p>



<p>先执行ruoyi-common，报错显示ruoyi-common-security模块deploy失败</p>



<p>再执行ruoyi-api模块deploy</p>



<p>ruoyi-api成功后再deploy ruoyi-common即可全部成功</p>



<h2 class="wp-block-heading">微服务中配置使用</h2>



<h3 class="wp-block-heading">nacos</h3>



<p>修改ruoyi-system微服务配置文件</p>



<p>将mybatis配置注释掉</p>



<pre class="wp-block-code"><code>## mybatis配置
#mybatis:
#    # 搜索指定包别名
#    typeAliasesPackage: com.ruoyi.feature
#    # 配置mapper的扫描，找到所有的mapper.xml映射文件
#    mapperLocations: classpath:mapper/**/*.xml</code></pre>



<p>添加mybatis-plus配置</p>



<pre class="wp-block-code"><code>mybatis-plus:
  global-config:
    db-config:
      # 逻辑已删除值
      logic-delete-value: 1
      # 逻辑未删除值
      logic-not-delete-value: 0
  configuration:
    #开启sql日志
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl 
  # Mapper.xml 文件位置 Maven 多模块项目的扫描路径需以 classpath*: 开头
  mapper-locations: classpath*:mapper/**/*Mapper.xml
  #  #MyBaits 别名包扫描路径，通过该属性可以给包中的类注册别名 实体扫描，多个package用逗号或者分号分隔
  type-aliases-package: com.ruoyi.feature
#  config-location: classpath:mybatis/mybatis-config.xml
  #  #通过父类（或实现接口）的方式来限定扫描实体
  #  typeAliasesSuperType: com.vanhr.user.dao.entity.baseEntity
  #  #枚举类 扫描路径 如果配置了该属性，会将路径下的枚举类进行注入，让实体类字段能够简单快捷的使用枚举属性
  #  typeEnumsPackage: com.vanhr.user.dao.enums
  # 启动时是否检查 MyBatis XML 文件的存在，默认不检查 仅限spring boot 使用
  checkConfigLocation : true
  #  #通过该属性可指定 MyBatis 的执行器，MyBatis 的执行器总共有三种：
  #  # ExecutorType.SIMPLE：该执行器类型不做特殊的事情，为每个语句的执行创建一个新的预处理语句（PreparedStatement）
  #  # ExecutorType.REUSE：该执行器类型会复用预处理语句（PreparedStatement）</code></pre>



<h3 class="wp-block-heading">ruoyi-system</h3>



<p>pom.xml中父类升级</p>



<pre class="wp-block-code"><code>&lt;parent&gt;
    &lt;groupId&gt;com.ruoyi&lt;/groupId&gt;
    &lt;artifactId&gt;ruoyi&lt;/artifactId&gt;
    &lt;version&gt;3.6.4&lt;/version&gt;
&lt;/parent&gt;</code></pre>



<pre class="wp-block-preformatted">&lt;parent&gt;<br>    &lt;groupId&gt;com.ruoyi&lt;/groupId&gt;<br>    &lt;artifactId&gt;ruoyi&lt;/artifactId&gt;<br>    &lt;version&gt;3.6.4.1&lt;/version&gt;<br>&lt;/parent&gt;</pre>



<p>更新maven后，可以看到ruoyi-system已引入了mybatis-plus相关依赖</p>



<p>启动服务，成功，操作完成</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.lhyshome.com/2024/05/30/152/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">152</post-id>	</item>
		<item>
		<title>Maven的scope</title>
		<link>https://blog.lhyshome.com/2024/05/28/138/</link>
					<comments>https://blog.lhyshome.com/2024/05/28/138/#respond</comments>
		
		<dc:creator><![CDATA[lhy]]></dc:creator>
		<pubDate>Tue, 28 May 2024 02:03:17 +0000</pubDate>
				<category><![CDATA[java]]></category>
		<category><![CDATA[maven]]></category>
		<guid isPermaLink="false">https://blog.lhyshome.com/?p=138</guid>

					<description><![CDATA[compile 编译依赖范围。如果没有指定，就会默认使用该依赖范围。使用此依赖范围的Maven 依赖，对于编译… <span class="read-more"><a href="https://blog.lhyshome.com/2024/05/28/138/">Read More &#187;</a></span>]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">compile</h2>



<p>编译依赖范围。如果没有指定，就会默认使用该依赖范围。使用此依赖范围的Maven 依赖，对于编译、测试、运行三种classpath 都有效。典型的例子是spring-core,在编译、测试和运行的时候都需要使用该依赖。既然运行时也要使用 scope 设为 compile 的依赖，所以 scope 为 compile 的依赖在项目打部署包的时候（即构建 artifact）<strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">会被一起打包，会放在 WEB-INF/lib 目录下。</mark></strong></p>



<h2 class="wp-block-heading">test</h2>



<p>测试依赖范围。使用此依赖范围的Maven依赖，只对于测试classpath有效，在编译主代码或者运行项目的使用时将无法使用此类依赖。典型的例子是JUnit,它只有在编译测试代码及运行测试的时候才需要。<br>scope 为 test 的依赖只在测试时使用，<strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">用于编译和运行测试代码，不会参与项目的打包。</mark></strong></p>



<h2 class="wp-block-heading">provided</h2>



<p>已提供依赖范围。使用此依赖范围的Maven依赖，对于编译和测试classpath有效，但在运行时无效（对运行的classpath无效）。典型的例子是 servlet-api, 编译和测试项目的时候需要该依赖，但在运行项目的时候，由于容器已经提供，就不需要Maven重复地引人一遍。既然运行时容器会提供，<strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">所以 scope 为 provided 的依赖不会参与项目的打包。</mark></strong></p>



<h2 class="wp-block-heading">runtime</h2>



<p>运行时依赖范围。使用此依赖范围的Maven依赖，对于测试和运行class-path有效，但在编译主代码时无效（对编译的classpath无效）。典型的例子是JDBC驱动实现，项目主代码的编译只需要JDK提供的JDBC接口，只有在执行测试或者运行项目的时候才需要实现上述接口的具体JDBC驱动。</p>



<p>既然运行时也要使用 scope 设为 runtime 的依赖，所以 scope 为 runtime 的依赖在项目打部署包的时候（即构建 artifact）<strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">会被一起打包，会放在 WEB-INF/lib 目录下。</mark></strong></p>



<h2 class="wp-block-heading">system</h2>



<p>系统依赖范围。该依赖与三种 classpath 的关系，和 provided 依赖范围完全一致。但是，system 范围的依赖不会从 maven 仓库下载，而是从本地文件系统获取，使用 system 范围的依赖时必须通过 元素显式地指定依赖文件的路径。</p>



<p>由于<strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">此类依赖不是通过 Maven 仓库解析的，而且往往与本机系统绑定</mark></strong>，可能造成构建（构建的产物有：classes和artifact）的不可移植，因此应该谨慎使用。</p>



<p>元素 可以引用环境变量，如下：</p>



<pre class="wp-block-code"><code>&lt;dependency&gt;
	&lt;groupId&gt;javax.sql&lt;/groupId&gt;
	&lt;artifactId&gt;jdbc-stext&lt;/artifactId&gt;
	&lt;version&gt;2.0&lt;/version&gt;
	&lt;scope&gt;system&lt;/scope&gt;
	&lt;systemPath&gt;${java.home}/lib/rt.jar&lt;/systemPath&gt; 
&lt;/dependency&gt;</code></pre>



<h2 class="wp-block-heading">import</h2>



<p>导入依赖范围，该依赖范围不会对三种 classpath 产生影响，该依赖范围只能与 元素配合使用，其功能为<strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">将目标pom.xml 文件中元素的配置导入合并到当前 pom.xml 文件的元素中</mark></strong>。有关元素 的功能请了解 Maven 继承特性。</p>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="917" height="485" src="https://blog.lhyshome.com/wp-content/uploads/2024/05/image-17.png" alt="" class="wp-image-146" srcset="https://blog.lhyshome.com/wp-content/uploads/2024/05/image-17.png 917w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-17-300x159.png 300w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-17-768x406.png 768w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-17-500x264.png 500w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-17-800x423.png 800w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-17-660x349.png 660w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-17-380x200.png 380w" sizes="(max-width: 917px) 100vw, 917px" /></figure>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.lhyshome.com/2024/05/28/138/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">138</post-id>	</item>
		<item>
		<title>docker安装nexus，搭建maven私服</title>
		<link>https://blog.lhyshome.com/2024/05/13/72/</link>
					<comments>https://blog.lhyshome.com/2024/05/13/72/#respond</comments>
		
		<dc:creator><![CDATA[lhy]]></dc:creator>
		<pubDate>Mon, 13 May 2024 07:58:21 +0000</pubDate>
				<category><![CDATA[java]]></category>
		<category><![CDATA[小技巧]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[maven]]></category>
		<guid isPermaLink="false">https://blog.lhyshome.com/?p=72</guid>

					<description><![CDATA[docker安装nexus 创建/home/nexus目录，并给其赋予777权限，完成后执行如下命令，等待启动… <span class="read-more"><a href="https://blog.lhyshome.com/2024/05/13/72/">Read More &#187;</a></span>]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">docker安装nexus</h2>



<p>创建/home/nexus目录，并给其赋予777权限，完成后执行如下命令，等待启动成功</p>



<pre class="wp-block-code"><code>docker run -d --restart always --name nexus3 -p 8081:8081 -v /home/nexus:/nexus-data sonatype/nexus3</code></pre>



<p>第一次登录用<strong>admin</strong>账号，密码在<strong>/home/nexus/admin.password</strong></p>



<h2 class="wp-block-heading">安装完成后</h2>



<h3 class="wp-block-heading">创建repository</h3>



<figure class="wp-block-image size-full"><img decoding="async" width="709" height="458" src="https://blog.lhyshome.com/wp-content/uploads/2024/05/image-6.png" alt="" class="wp-image-73" srcset="https://blog.lhyshome.com/wp-content/uploads/2024/05/image-6.png 709w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-6-300x194.png 300w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-6-500x323.png 500w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-6-660x426.png 660w" sizes="(max-width: 709px) 100vw, 709px" /></figure>



<p>创建如下图三个</p>



<figure class="wp-block-image size-full"><img decoding="async" width="674" height="134" src="https://blog.lhyshome.com/wp-content/uploads/2024/05/image-8.png" alt="" class="wp-image-75" srcset="https://blog.lhyshome.com/wp-content/uploads/2024/05/image-8.png 674w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-8-300x60.png 300w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-8-500x99.png 500w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-8-660x131.png 660w" sizes="(max-width: 674px) 100vw, 674px" /></figure>



<p>snapshots和releases创建时应设置Version policy为对应类型，Deployment policy为Allow redeploy（设置后可以上传），public设置为mixed</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="598" src="https://blog.lhyshome.com/wp-content/uploads/2024/05/image-9-1024x598.png" alt="" class="wp-image-76" srcset="https://blog.lhyshome.com/wp-content/uploads/2024/05/image-9-1024x598.png 1024w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-9-300x175.png 300w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-9-768x449.png 768w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-9-500x292.png 500w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-9-800x467.png 800w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-9-660x385.png 660w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-9.png 1190w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>设置public时应将之前创建的snapshots和releases加入到members中去</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="732" src="https://blog.lhyshome.com/wp-content/uploads/2024/05/image-10-1024x732.png" alt="" class="wp-image-77" srcset="https://blog.lhyshome.com/wp-content/uploads/2024/05/image-10-1024x732.png 1024w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-10-300x214.png 300w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-10-768x549.png 768w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-10-500x357.png 500w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-10-800x572.png 800w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-10-660x472.png 660w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-10.png 1103w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h3 class="wp-block-heading">创建用户及角色</h3>



<p>创建角色，并将将创建的repository权限赋予当前角色</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="697" src="https://blog.lhyshome.com/wp-content/uploads/2024/05/image-11-1024x697.png" alt="" class="wp-image-78" srcset="https://blog.lhyshome.com/wp-content/uploads/2024/05/image-11-1024x697.png 1024w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-11-300x204.png 300w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-11-768x523.png 768w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-11-500x340.png 500w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-11-800x545.png 800w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-11-660x449.png 660w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-11.png 1150w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>创建用户，在roles中勾选刚刚创建的角色</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="706" src="https://blog.lhyshome.com/wp-content/uploads/2024/05/image-12-1024x706.png" alt="" class="wp-image-79" srcset="https://blog.lhyshome.com/wp-content/uploads/2024/05/image-12-1024x706.png 1024w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-12-300x207.png 300w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-12-768x529.png 768w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-12-500x345.png 500w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-12-800x551.png 800w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-12-660x455.png 660w, https://blog.lhyshome.com/wp-content/uploads/2024/05/image-12.png 1139w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">使用</h2>



<h3 class="wp-block-heading">maven的settings.xml配置，控制从私有仓库中的同步拉取jar</h3>



<pre class="wp-block-preformatted">&lt;server&gt;<br>    &lt;!-- id为当前用户id，后续在需要使用此用户时，对应所有id都应该用此id --&gt;<br>    &lt;id&gt;lhy-maven&lt;/id&gt;<br>    &lt;username&gt;lhy&lt;/username&gt;<br>    &lt;password&gt;password&lt;/password&gt;<br>&lt;/server&gt;<br>...........<br>                &lt;repository&gt;<br>                    &lt;id&gt;lhy-maven&lt;/id&gt;<br>                    &lt;url&gt;http://192.168.0.200:8081/repository/lhy-public/&lt;/url&gt;<br>                    &lt;releases&gt;<br>                        &lt;enabled&gt;true&lt;/enabled&gt;<br>                    &lt;/releases&gt;<br>                    &lt;snapshots&gt;<br>                        &lt;enabled&gt;true&lt;/enabled&gt;<br>                    &lt;/snapshots&gt;<br>                &lt;/repository&gt;</pre>



<h3 class="wp-block-heading">项目中的pom.xml，控制往私有仓库中deploy，不需要deploy的不需要配置</h3>



<pre class="wp-block-code"><code>&lt;distributionManagement&gt;
    &lt;repository&gt;
        &lt;!--注意这个id一定要填写我们maven的setting.xml当中配置的id--&gt;
        &lt;id&gt;lhy-maven&lt;/id&gt;
        &lt;url&gt;http://ip:port/repository/lhy-releases/&lt;/url&gt;
    &lt;/repository&gt;
    &lt;snapshotRepository&gt;
        &lt;!--注意这个id一定要填写我们maven的setting.xml当中配置的id--&gt;
        &lt;id&gt;lhy-maven&lt;/id&gt;
        &lt;url&gt;http://ip:port/repository/lhy-snapshots/&lt;/url&gt;
    &lt;/snapshotRepository&gt;
&lt;/distributionManagement&gt;</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.lhyshome.com/2024/05/13/72/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">72</post-id>	</item>
	</channel>
</rss>
