IDEA - ruoyi - srpingboot - 离线运行

前提:有项目对应的repository文件,RY的DB配置正常(mysql新增schema ry, 执行 /sql下的sql文件,同步调整ruoyi-admin下的application-druid.yml文件中的mysql配置)

源码:git clone https://gitee.com/y_project/RuoYi.git 或其它地址

1. 外网情况下,IDEA导入项目,pom文件配置aliyun仓库地址:

 <pluginRepositories>
        <pluginRepository>
            <id>aliyun-plugin</id>
            <url>https://maven.aliyun.com/repository/public</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

2. 在 IDEA Settings -> Build, Execution, Depployment -> Build Tools -> Maven:

User settings file: settings.xml文件设定localRepository的值为本地repository文件路径

Local repository: 设定本地repository文件路径

3. 项目可正常运行,操作右侧maven项目菜单

  2.1 点击ruoyi -> Lifecycle -> install 

  2.2 点击ruoyi -> ruoyi-common -> Dependencies,右键点击Download Sources and Documentation,其它模块均操作一遍

 

内网环境:

1. 执行 https://www.cnblogs.com/uoky/articles/16499444.html 中的方法,将多余文件删除

2.设定IDEA Settings -> Build, Execution, Depployment -> Build Tools -> Maven:

Local repository: repository文件路径

User settings file: settings.xml文件更新:

新增1:<localRepository>D:/aaaa/.m2/repository</localRepository> (localRepository为存放的repository文件路径)

新增2:

<mirrors>
<mirror>
<id>central</id>
<name>central</name>
<!-- 将镜像地址设置为本地maven仓库地址 -->
<url>file://D:/aaaa/.m2/repository</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>

如果没有settings.xml文件,则新建文件settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository>D:/aaaa/.m2/repository</localRepository>

  <pluginGroups>
  </pluginGroups>
  <proxies>
  </proxies>
  <servers>
  </servers>
  <mirrors>
      <mirror>
          <id>central</id>
          <name>central</name>
          <!-- 将镜像地址设置为本地maven地址 -->
          <url>file://D:/aaaa/.m2/repository</url>
          <mirrorOf>*</mirrorOf>

      </mirror>
  </mirrors>
    <!-- jdk按需设定,可不设定 -->
  <profiles>
    <profile>
         <id>jdk-1.8</id>
        <activation>
            <activeByDefault>true</activeByDefault>
            <jdk>1.8</jdk>
        </activation>
        <properties>
            <maven.compiler.source>1.8</maven.compiler.source>
            <maven.compiler.target>1.8</maven.compiler.target>
            <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
        </properties>
    </profile>
  </profiles>
</settings>
View Code

3. IDEA File -> new -> Project from Existing Sources -> 代码路径 OK

运行即可

 

posted @ 2022-07-21 10:24  人间春风意  阅读(92)  评论(0编辑  收藏  举报