How to import and successfully run the project ocProject
First, download the project
Download project ocProject, opened on the hard disk directory structure is as follows:
ocOperator, ocPortal, ocRest, ocWechat depend on ocService and ocCommon, to achieve multiplexing of the underlying business function. Project may Eclipse, IntelliJ import use, the following describes how to import the Eclipse project.
Two, Eclipse project import
2.1, open Eclipse, menu bar, select "File" Import "
2.2, choose Existing Maven Projects, find the root directory of your downloaded items, such as:
Observe, the output of each item after packaging pom file, ocCommon and are ocService jar package, for other web applications (e.g. ocPortal) referenced and used.
2.3, the structure after completion of introduction of the project as follows:
If the first imported because maven to download the corresponding jar package, so there may be a little slow. For some detailed combing maven, project structure, we do introduce later in the article. At this point, the project is imported successfully, the following can be configured JDK, Tomcat, etc.
Third, the project coding, JDK, Maven Dependencies, Tomcat configuration
3.1, all items are encoded as UTF-8, so check first item code:
1) on the project right "Properties" Resource can see the coding of the project;
2) just to find a .java files, .xml files, .html files right view encoding format, if the encoding is GBK, please read UTF-8 encoding. Modified as follows:
the Eclipse menu bar "Window" Preferences (such as html files instead of talking about all the UTF-8 format)
3.2、配置JDK
JDK最好使用7或者8版本,前提是你本地已经安装了JDK和JRE。如果大家做过java开发,相信这一步已经搞定了。
Eclipse菜单栏》Window》Preferences
3.3、配置Maven Dependencies 和 Java Build Path
ocCommon和ocService是必须要配置的,因为他们是核心的模块。
在项目上右键》Properties
然后再点击 确定 即可!
再配置一下 Java Build Path
JRE配置完毕,对于ocService、ocPortal、ocOperator等其他项目同样配置。总之要将 maven、JRE都配置正确。
3.4、体验一下Maven的clean和install(package)
我们可以用Eclipse自带的maven插件进行clean和install项目,在ocProject项目上,右键》Run As》maven clean(maven install)即可。
3.5、安装MySql数据库
前提是你本机已经安装了Mysql数据库。使用Navicat连接上MySql数据库,然后新建一个库,比如ocdb(编码格式选择UTF-8)。
然后将ocProject/doc/install.sql中的内容拷贝进去执行,完成数据库的初始化操作。
在ocPortal项目的src/main/resources中jdbc.properties的用户名和密码为root/root123,如果和你的数据库配置不一样,请自行修改。
至此,我们运行前的基本配置都已经结束了,下面就来运行一下项目。
3.6, Tomcat to run the project
Eclipse to configure Tomcat: Window "Preferences
On ocPortal project, right "Run As" Run On Server "
Click Finish, to run the project.
Tomcat default port number is 8080,