ubuntu环境下GitHub+Maven+MVC手工实现银行系统

一.配置GitHub

首先你得有gitHub帐号以及自己的工作仓库,如果没用过gitHub的同学请自行百度学习。

有自己git的同学进入git  —— new Respository

之后将远程仓库clone到本地仓库

——git clone https://github.com/yixiangli/bank2.0

注意:

此处需要创建ssh key(详细过程不再阐述,关于gitHub的使用请百度)

二.配置maven

在gitHub的本地仓库目录级下新建pom.xml 用于maven的基本配置

同级文件应该有gitHub的README.md与src  src下有main和test  main中含有java java中存放的则是项目文件。


最好使用自动构建骨架

mvn archetype:generate -DgroupId=com.cx.bank -DartifactId

=bank2.0 -Dversion=2.0.1



三.测试gitHub与maven的配置

(1)配置maven

<groupId>com.cx.bank.test</groupId>  (模块名)

    <artifactId>bank2.0</artifactId>        (项目名)

    <version>1.0-SNAPSHOT</version>

    <packaging>jar</packaging>


    <name>bank2.0</name>

    <url>http://maven.apache.org</url>


    <properties>

     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    </properties>


(2)编译

maven会自动下载所需包以及新建target目录作为存放class文件

命令mvn compile

测试:

进入target/classes中 java运行即可



(3)上传gitHub

请全部使用终端操作 github 常见步骤如下:

1 git pull (从github上把代码pull下来并和本地合并) 

2 git add . (添加,更新) 

3 git add -A (删除文件了才使用) 

4 git commit -m 'message' (提交到本地库)

5 git push (千万不要git push --force,这是强置push导致覆盖服务器的数据变得和本地一模一样,并须先git pull)



四.测试部署tomcat

(1)配置tomcat角色  

tomcat 7.x   在conf/tomcat-users.xml

<tomcat-users> 

   

  <role rolename="manager"/> 

  <role rolename="manager-script"/> 

  <role rolename="admin-gui"/> 

  <role rolename="manager-gui"/>   

  

  <user username="admin" password="pass!@#" roles="manager,manager-gui,admin-gui,manager-script"/> 

(2)使用tomcat的虚拟路径方法

<Context path="/bankSystem" docBase="/home/liyixiang/银行v2.0/bank2.0/bank2.0/src/main/webapp" reloadable="true"></Context>


(3)maven本地库链接tomcat

C:\Documents and Settings\Administrator\.m2\settings.xml 文件打开,写入用户名和密码


<servers>

<server>  

       <id>tomcat</id>  

       <username>admin</username>  

       <password>pass!@#</password>  

</server>  

</servers>


(4)修改pom.xml 配置tomcat-maven的插件

<build>

    <plugins>

     <plugin>

      <groupId>org.codehaus.mojo</groupId>

      <artifactId>tomcat-maven-plugin</artifactId>

      <configuration>

       <url>http://localhost:8888/manager</url>

       <server>tomcat</server>

      </configuration>

     </plugin>

    </plugins>

 </build>


(5)下载tomcat-maven的插件的jar

<repositories>

        <repository>

            <id>people.apache.snapshots</id>

            <url>

                http://repository.apache.org/content/groups/snapshots-group/

            </url>

            <releases>

                <enabled>false</enabled>

            </releases>

            <snapshots>

                <enabled>true</enabled>

            </snapshots>

        </repository>

    </repositories>

    <pluginRepositories>

        <pluginRepository>

            <id>apache.snapshots</id>

            <name>Apache Snapshots</name>

            <url>

                http://repository.apache.org/content/groups/snapshots-group/

            </url>

            <releases>

                <enabled>false</enabled>

            </releases>

            <snapshots>

                <enabled>true</enabled>

            </snapshots>

        </pluginRepository>

    </pluginRepositories>


(6)访问http://127.0.0.1:8888/bankSystem/index.jsp

成功!太不容易了!


五.开始银行项目


转载于:https://my.oschina.net/liyixiangBlog/blog/313351

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值