HAND-HAP-构建项目步骤

本文详细介绍如何配置数据源、创建Maven项目、设置数据库权限、执行数据迁移脚本及启动Redis与Tomcat服务器,为部署HAP Shipments应用提供完整步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

配置数据源 D:\apache-tomcat-8.5.24\conf\context.xml 
	<Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/hap_shipments" 	name="jdbc/hap_shipments" type="javax.sql.DataSource" username="hap_dev" password="hap_dev"/>

创建项目 mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate  -D archetypeGroupId=hap -D 	archetypeArtifactId=hap-webapp-archetype -D archetypeVersion=3.1-SNAPSHOT -D groupId=shipments -D artifactId=ShipmentsParent -D 	package=shipments.core -D archetypeRepository=http://nexus.saas.hand-china.com/content/repositories/rdcsnapshot

新建数据库 create schema hap_shipments default character set utf8;
	CREATE USER hap_dev@'%' IDENTIFIED BY 'hap_dev';
	CREATE USER hap_dev@'localhost' IDENTIFIED BY 'hap_dev';
	GRANT ALL PRIVILEGES ON hap_shipments.* TO hap_dev@'%';
	GRANT ALL PRIVILEGES ON hap_shipments.* TO hap_dev@'localhost';

	flush privileges;

导入IDEA

将sql文件拷入 ShipmentsParent\core-db\src\main\java\shipments\core\db\data\mysql 
修改shipments/core/db/2016-06-01-init-data-migration.groovy
	changeSet(author: "mrz", id: "20171218-mrz-1") {
            sqlFile(path: MigrationHelper.getInstance().dataPath("com/hand/hap/db/data/"+dbType+"/xxinv_material_item.sql"), encoding: "UTF-8")
            sqlFile(path: MigrationHelper.getInstance().dataPath("com/hand/hap/db/data/"+dbType+"/xxinv_material_txns.sql"), encoding: "UTF-8")
            sqlFile(path: MigrationHelper.getInstance().dataPath("com/hand/hap/db/data/"+dbType+"/xxinv_shiped_doc.sql"), encoding: "UTF-8")
            sqlFile(path: MigrationHelper.getInstance().dataPath("com/hand/hap/db/data/"+dbType+"/xxinv_shiped_doc_lines.sql"), encoding: "UTF-8")
    }
	
执行 mvn process-resources -D skipLiquibaseRun=false -D db.driver=com.mysql.jdbc.Driver -D db.url=jdbc:mysql://127.0.0.1:3306/hap_shipments -D db.user=hap_dev -D db.password=hap_dev

启动redis 
	cd /  
	cd Redis-x64-3.2.100
	redis-server.exe redis.windows.conf
	
在IDEA中配置TomCat

运行 ShipmentsParent\core\overlays\com.hand.hap-3.3.1-RELEASE\WEB-INF\view\index.html

创建目录
 core(前面的包名称)
│           │   │       │   
│           │   │       ├── controllers(Controller包)
│           │   │       │   └── DemoController.java(Controller类)
│           │   │       ├── db(数据表结构,数据初始化入口文件)
│           │   │       │   └── liquibase.groovy
│           │   │       ├── dto(Dto包)
│           │   │       │   └── Demo.java(Dto实现类)
│           │   │       ├── mapper(Mapper包)
│           │   │       │   ├── DemoMapper.java(Mapper接口)
│           │   │       └── service(Service包)
│           │   │           ├── IDemoService.java
│           │   │           └── impl(Service实现)
│           │   │               └── DemoServiceImpl.java


按照数据表新建Dto实现类,根据字段private、get、set。

觉得有帮助的小伙伴右上角点个赞~

在这里插入图片描述

扫描上方二维码关注我的订阅号~

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

张兴华(MarsXH.Chang)

喜欢的可以请作者喝杯咖啡~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值