当前位置:   article > 正文

Gitee搭建自己的Maven仓库_gitee maven仓库

gitee maven仓库

一、在gitee中创建仓库,并开源。

二、首先在需要deploy的项目内的pom文件里加入以下内容

	<build>
   		<plugins>
   			<plugin>
   				<groupId>org.apache.maven.plugins</groupId>
   				<artifactId>maven-assembly-plugin</artifactId>
   				<version>2.6</version>
   				<configuration>
   					<descriptorRefs>
   						<descriptorRef>jar-with-dependencies</descriptorRef>
   					</descriptorRefs>
   					<encoding>UTF-8</encoding>
   				</configuration>
   				<executions>
   					<execution>
   						<id>make-assembly</id>
   						<phase>package</phase>
   						<goals>
   							<goal>single</goal>
   						</goals>
   					</execution>
   				</executions>
   			</plugin>

   			<plugin>
   				<groupId>org.apache.maven.plugins</groupId>
   				<artifactId>maven-compiler-plugin</artifactId>
   				<configuration>
   					<source>8</source>
   					<target>8</target>
   				</configuration>
   			</plugin>

   			<plugin>
   				<groupId>org.apache.maven.plugins</groupId>
   				<artifactId>maven-plugin-plugin</artifactId>
   				<version>3.5</version>
   			</plugin>

   			<plugin>
   				<groupId>org.apache.maven.plugins</groupId>
   				<artifactId>maven-deploy-plugin</artifactId>
   				<version>2.7</version>
   			</plugin>

   		</plugins>
   	</build>

    <distributionManagement>
        <repository>
            <!-- id随意,我是仓库名-->
            <id>wys-warehouse</id>
            <!-- 下面的地址是当deploy的时候,项目部署的位置,我们需要先存在电脑的某个位置,所以根据自己决定 -->
            <url>file:D:/maven/jar/share/</url>
        </repository>
    </distributionManagement>

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56

三.执行maven deploy命令将项目编译到本地:

mvn deploy -DaltDeploymentRepository=wys-warehouse::default::file:D:/maven/jar/share/
  • 1

四.我们为D:/maven/jar/share/创建git仓库

cd D:/maven/jar/share/
git init 
## add上传的文件
git add com/*
## 本地提交
git commit -m 'deploy xxx'
git remote add origin https://xxx/wys-warehouse.git
##上传到远程仓库
git push origin master
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 当你发布新的版本时(也就是该本地仓库有变动时),要记住提交并push到远程仓库!(不然你的仓库并不会有你最新发布的内容)
  • 当远程仓库有更新时需更新到本地
## 更新远程仓库到本地
git pull origin master --allow-unrelated-histories
  • 1
  • 2

五、在项目中引入jar或者插件仓库配置

jar配置:

  <repositories>
        <repository>
           <id>wys-warehouse</id>
           <url>https://xxx/raw/master</url>
        </repository>
    </repositories>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

插件配置

   <pluginRepositories>
    	  <pluginRepository>
    	  	<id>wys-warehouse</id>
    		<url>https://xxx/raw/master</url>
      	  </pluginRepository>
   </pluginRepositories>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

六、引入插件并执行

  • 以下以我自己的插件为例

pom.xml引入插件

  <plugin>
    	<groupId>com.wys</groupId>
    	<artifactId>mybatis-plus-plugins</artifactId>
    	<version>1.0.0</version>
    	<configuration>
    		<configFile>${basedir}/src/main/resources/mybatis-plus.json</configFile>
    		<ignores>
    			<include>controller</include>
    			<include>service</include>
    		</ignores>
    		<includes>
    			<property>
    				<name>Vo</name>
    				<value>/templates/VO.java.vm</value>
    			</property>
    			<property>
    				<name>Dto</name>
    				<value>/templates/Dto.java.vm</value>
    			</property>
    		</includes>
    	</configuration>
    </plugin>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

执行插件

  • mvn groupId:artifactId:version:goal
  mvn com.wys:mybatis-plus-plugins:1.0.0:touch
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/130640
推荐阅读
相关标签
  

闽ICP备14008679号