180 lines
5.9 KiB
Markdown
180 lines
5.9 KiB
Markdown
|
||
|
||
# ecology开发环境
|
||
|
||
> 当前项目用于有兴趣一起协同开发的同事一起使用
|
||
>
|
||
> @author youHong.ai
|
||
|
||
## 项目构建启动
|
||
|
||
### 项目拉取配置
|
||
|
||
1. 新建项目文件夹
|
||
|
||
![image-20221122111433147](static/image-20221122111433147.png)
|
||
|
||
2. 执行git命令配置名称
|
||
|
||
```shell
|
||
git config --global user.name "yourName" # yourName 填写拼音,如you Hong.ai
|
||
```
|
||
|
||
3. 克隆项目
|
||
|
||
```shell
|
||
git clone git@gitee.com:it-xiaoxiong/e9-project-ebu7-dev1.git
|
||
# 或
|
||
git clone https://gitee.com/it-xiaoxiong/e9-project-ebu7-dev1.git
|
||
```
|
||
|
||
![image-20221122112306439](static/image-20221122112306439.png)
|
||
|
||
4. 项目导入idea
|
||
|
||
<img src="static/image-20221122113730903.png" alt="image-20221122113730903" style="zoom:50%;" />
|
||
|
||
<img src="static/image-20221122113814398.png" alt="image-20221122113814398" style="zoom:50%;" />
|
||
|
||
等待pom文件构建完成
|
||
|
||
![image-20221122113916299](static/image-20221122113916299.png)
|
||
|
||
5. 设置项目
|
||
|
||
在test文件夹中创建`resources`文件夹
|
||
|
||
<img src="static/image-20221123113034272.png" alt="image-20221123113034272" style="zoom: 50%;" />
|
||
|
||
新建lib\classbean文件夹(在lib下面新建classbean)
|
||
|
||
<img src="static/image-20221122114236545.png" alt="image-20221122114236545" style="zoom:50%;" />
|
||
|
||
设置项目结构
|
||
|
||
|
||
|
||
<img src="static/image-20221122113957228.png" alt="image-20221122113957228" style="zoom:33%;" />
|
||
|
||
![image-20221122114029683](static/image-20221122114029683.png)
|
||
|
||
![image-20221123101605986](static/image-20221123101605986.png)
|
||
|
||
![image-20221122114530103](static/image-20221122114530103.png)
|
||
|
||
<img src="static/image-20221122114617851.png" alt="image-20221122114617851" style="zoom: 33%;" />
|
||
|
||
如果有下面弹窗点击ok
|
||
|
||
<img src="static/image-20221122114642931.png" alt="image-20221122114642931" style="zoom:33%;" />
|
||
|
||
同样的方式将classbena和classbeanLib添加
|
||
|
||
<img src="static/image-20221122114743331.png" alt="image-20221122114743331" style="zoom:50%;" />
|
||
|
||
切换到Modules中,点击依赖项,修改sdk版本,看是否将之前的依赖是否存在,不存在点击左上角的加号导入进来
|
||
|
||
|
||
|
||
![image-20221122114849406](static/image-20221122114849406.png)
|
||
|
||
<img src="static/image-20221122115008978.png" alt="image-20221122115008978" style="zoom:33%;" />
|
||
|
||
最后点击应用(apply)后点击确认(ok)等待项目构建索引完毕
|
||
|
||
|
||
|
||
### 项目配置
|
||
|
||
将你本地demo的weaver.properties文件复制到src/main/resources/web-inf/prop文件夹中
|
||
|
||
<img src="static/image-20221122115303606.png" alt="image-20221122115303606" style="zoom:33%;" />
|
||
|
||
在test/resources文件夹中创建两个文件
|
||
|
||
`application.xml`
|
||
|
||
```xml
|
||
<?xml version="1.0" encoding="UTF-8" ?>
|
||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||
<beans>
|
||
<bean id="propertyPlaceholderConfigurer"
|
||
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||
<property name="locations" value="classpath:application.properties" />
|
||
</bean>
|
||
<bean id="basetest" class="basetest.BaseTestConfig">
|
||
<property name="serverName" value="${serverName}"/>
|
||
<property name="rootPath" value="${rootPath}"/>
|
||
<property name="systemFilePath" value="${systemFilePath}"/>
|
||
<property name="logPath" value="${logPath}"/>
|
||
</bean>
|
||
</beans>
|
||
```
|
||
|
||
`application.properties`
|
||
|
||
```properties
|
||
serverName=ecology
|
||
rootPath=/Users/aoey.oct.22/company/Fan_wei/code/idea/ecology9-project/src/main/resources/ # 修改为实际的地址
|
||
systemFilePath=/Users/aoey.oct.22/company/Fan_wei/code/idea/ecology9-project/file # 修改为实际的地址,这里可以是你实际ecology的文件地址,即.../ecolog/web-inf/systemfile 绝对路径
|
||
logPath=/Users/aoey.oct.22/company/Fan_wei/code/idea/ecology9-project/log # 修改为实际的地址
|
||
```
|
||
|
||
|
||
|
||
### 测试
|
||
|
||
找到BaseTest文件,执行`public void with()`方法,如果正常执行如下即表示成功
|
||
|
||
![image-20221122124724449](static/image-20221122124724449.png)
|
||
|
||
|
||
|
||
## 使用规范
|
||
|
||
|
||
|
||
包命名时,需要使用自己的名字作为包名称,如`com.youhong.ai`, `weaver.youhong.ai`
|
||
|
||
业务代码写在个人包下面,通用工具类单独抽出来存放在`ebu7common`包下面,即`src/mian/java/ebu7common`
|
||
|
||
如果有已经部署到客户环境的共有方法和类,不需要改变原有结构,防止出意外,新增的公有方法按照规范进行
|
||
|
||
![image-20221122125200782](static/image-20221122125200782.png)
|
||
|
||
|
||
|
||
==注意点==
|
||
|
||
> 注意事项
|
||
|
||
* 修改`.gitignore`文件时请注意不要将自己的配置文件(weaver.properties)包含在git管理中,需要排除在外(默认已经排除),已排除的文件尽量不要修改规则
|
||
* 如果项目中需要修改源码,请将涉及到修改源码的文件外出在git管理中,防止影响其他开发人员进行开发或二次修改源码引起的冲突
|
||
* 尽量每天工作完毕提交一次代码,但是需要保证代码能够正常通过编译,每天早上工作前同步一遍代码
|
||
* 提交代码之前先拉取代码到本地
|
||
* 遇到代码冲突时,冲突代码需要与他人沟通后处理
|
||
* maven文件中导如依赖需要注意依赖是否会和应用产生冲突
|
||
|
||
|
||
|
||
## 依赖更换
|
||
|
||
> 当前使用的依赖是Ecology9.00.2206.03的依赖
|
||
|
||
如果需要更改依赖的话,只需要将lib中的jar包更换为所需版本的依赖
|
||
|
||
具体方法如下lib/weaverLib/下的所有jar包和文件对应ecology/web-inf/lib中的jar和文件,只需将其删除并吧ecology/web-inf/lib中的文件拷贝到对应目录中即可
|
||
|
||
lib/classbeanLib/下的jar包对应ecology/classbean下的class文件,具体更换方式需要先进入到ecology/classbean目录中,打开终端(处于当前ecology/classbean目录中),执行一下代码
|
||
|
||
```shell
|
||
jar -cvf ecology-dev-lib.jar com DBstep weaver
|
||
```
|
||
|
||
进入ecology/web-inf/classes执行如下代码
|
||
|
||
```shell
|
||
jar -cvf web-inf-class-lib.jar com weaver org
|
||
```
|
||
|
||
将生成的jar包替换掉原来的jar包即可 |