/*
* 使用gitbash将写好的普通java程序上传到仓库中
*/
一.创建java项目
mvn archetype:generate -DgroupId=com.workjava -DartifactId=workjava -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false -DarchetypeCatelog=internal
// 1.注意其中的中文字符2.groupId是包名,factId是文件名 3.后面加-DarchetypeCatelog=internal是为了加快速度
二.编译文件
mvn compile
三.执行文件
mvn exec:java -Dexec.mainClass="com.workjava.App" //双引号中是你包名下的类名
四.在README.md中填写对这个程序的描述
五.开始上传
git init
git status
git add .
git commit -m "first commit"
git remote add origin https://github.com/XXX/test2.git
git push -u origin master
// 注意这个网址中的test2一定是你在github中已经新建的仓库,如果遇到已经存在remote,你可以使用git remote rm origin 来减除remote
六.刷新你的github页面就可以了
注意:仓库中的内容:README.md src .gitignore pom.xml
将你需要的jar包写在pom.xml依赖中即可,其他文件用.gitignore忽略
七、遇到的错误
使用:
git push -f origin master
八、创建hap项目mvn参数说明
mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -D archetypeGroupId=hap -D archetypeArtifactId=hap-webapp-archetype -D archetypeVersion=3.0-SNAPSHOT -D groupId=hbi -D artifactId=HbiParent -D package=hbi.core -D archetypeRepository=http://nexus.saas.hand-china.com/content/repositories/rdcsnapshot
依赖仓库中war包目录结构:hap -> hap-webapp-archetype -> 3.0-SNAPSHOT
项目目录结构:HbiParent -> hbi.core