Eclipse的使用

eclipse是一个绿色版的软件。

工作空间:就是一个存放的代码项目的文件夹。

设置工作空间的编码集:


eclipse的jre环境的配置:


基础的配置:
重置窗口


javaweb项目的创建:
 


web项目集成tomcat:-->web中间件
集成方式一:





集成方式二:


jre环境的问题与配置:





右键项目-->properties,修改编译的版本

修改后会出现如下的问题:

解决:项目右键-->properties


xsd离线约束的配置:
在联网状态下,配置文件的标签能够自动提示。但是在没有联网的状态下并不会自动提示。
window-->perference-->添加本地的约束文件



在web项目中创建 resources 文件夹。


Eclipse中debug的使用:

在Eclipse中添加resources目录:

如果没有该目录。
项目右键-->new-->source folder --> Folder name 

Eclipse中集成Maven




构建maven索引




在Eclipse中创建maven工程:
1、创建maven父工程:


2、创建web子模块工程。右键此父工程-->new-->other-->maven module    

此时web项目会报错。在此web子模块项目中添加缺失的web.xml配置文件。
在web项目的pom.xml中引入依赖信息。

3、创建service子模块工程。右键此父工程-->new-->other-->maven module    
导入所需的依赖

4、在web层的pom.xml中需要依赖服务层。
在web的pom.xml中右键-->maven-->add dependency

需要在web子模块中  src/main/resources 添加。spring相关的配置文件。
又因为在spingmvc.xml中配置了:
 <context:property-placeholder location="classpath:config/application.properties" />
需要将config文件夹也添加进去。
到此,web的相关配置大致完成了。

5、在service模块中
需要加入服务层的相关配置和事务的相关配置

6、创建dao子模块工程
导入相关的依赖
在  src/main/resources   编写相关的配置信息。
然后在service层中去依赖dao层。
在itheima-service子模块项目中,右键-->maven-->add dependency。则在pom.xml会自动添加依赖。


Eclipse中删除及导入java项目和maven项目
导入普通项目和maven项目,存在区别:
普通项目:
  在左侧项目栏的空白处右键-->import-->General--->Existing Project into Workspace-->next
 maven项目:
  左侧项目栏的空白处右键-->import-->Maven-->Existing Maven Project-->next
  选择父工程就会自动导入关联的子模块。

Eclipse整合SVN
保证电脑安装有svn服务器切实在启动的状态。
 在eclipse中没有提供svn相关的view。需要自己手动继承svn。
需要将svn的插件继承到eclipse中。
将site-1.10.11  中的文件  features  和 plugins  文件夹拷贝到svn文件夹中。在将其svn文件夹复制到eclipse安装包中。

重启eclipse。


选择svn资源库


此时只是共享项目到svn服务器中,尚未提交。


提交的日志信息

 Filesystem has no item
svn: URL 'https://laptop-93dsccod:8443/svn/itheima/itheima-02/itheima-02' non-existent in revision 0

mkdir --parents -m "初始导入。" [https://laptop-93dsccod:8443/svn/itheima/itheima-02/itheima-02]
    Unknown action received: commit finalizing
checkout https://laptop-93dsccod:8443/svn/itheima/itheima-02/itheima-02 -r HEAD --depth=immediates --force
    Checked out revision 1.
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent\WEB-INF
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent\WEB-INF\lib
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\resources
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/resources
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\src
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/src
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\src\com
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/src/com
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\src\com\itheima
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/src/com/itheima
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\src\com\itheima\web
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/src/com/itheima/web
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\src\com\itheima\web\helloworld
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/src/com/itheima/web/helloworld
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent\WEB-INF\lib\spring-web-4.2.4.RELEASE.jar
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-web-4.2.4.RELEASE.jar
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent\WEB-INF\lib\com.springsource.org.aopalliance-1.0.0.jar
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/com.springsource.org.aopalliance-1.0.0.jar
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\resources\springmvc.xml
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/resources/springmvc.xml
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent\WEB-INF\lib\spring-jdbc-4.2.4.RELEASE.jar
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-jdbc-4.2.4.RELEASE.jar
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent\index.html
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/index.html
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent\WEB-INF\lib\spring-core-4.2.4.RELEASE.jar
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-core-4.2.4.RELEASE.jar
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent\WEB-INF\lib\spring-expression-4.2.4.RELEASE.jar
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-expression-4.2.4.RELEASE.jar
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent\WEB-INF\lib\spring-context-4.2.4.RELEASE.jar
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-context-4.2.4.RELEASE.jar
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent\WEB-INF\lib\spring-aop-4.2.4.RELEASE.jar
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-aop-4.2.4.RELEASE.jar
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent\test01.html
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/test01.html
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\src\com\itheima\web\helloworld\HelloWorld.java
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/src/com/itheima/web/helloworld/HelloWorld.java
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent\WEB-INF\lib\spring-aspects-4.2.4.RELEASE.jar
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-aspects-4.2.4.RELEASE.jar
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent\WEB-INF\lib\spring-beans-4.2.4.RELEASE.jar
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-beans-4.2.4.RELEASE.jar
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent\WEB-INF\lib\com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent\WEB-INF\lib\spring-webmvc-4.2.4.RELEASE.jar
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-webmvc-4.2.4.RELEASE.jar
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent\WEB-INF\web.xml
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/web.xml
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent\WEB-INF\lib\com.springsource.org.apache.commons.logging-1.1.1.jar
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/com.springsource.org.apache.commons.logging-1.1.1.jar
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent\WEB-INF\lib\spring-orm-4.2.4.RELEASE.jar
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-orm-4.2.4.RELEASE.jar
add -N F:\CODE_SPACE\SouceCode\BASE_0\itheima-02\WebContent\WEB-INF\lib\spring-tx-4.2.4.RELEASE.jar
    A         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-tx-4.2.4.RELEASE.jar
commit -m "初始化构建项目" -N (28 paths specified)
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/com.springsource.org.aopalliance-1.0.0.jar
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/com.springsource.org.apache.commons.logging-1.1.1.jar
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-aop-4.2.4.RELEASE.jar
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-aspects-4.2.4.RELEASE.jar
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-beans-4.2.4.RELEASE.jar
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-context-4.2.4.RELEASE.jar
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-core-4.2.4.RELEASE.jar
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-expression-4.2.4.RELEASE.jar
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-jdbc-4.2.4.RELEASE.jar
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-orm-4.2.4.RELEASE.jar
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-tx-4.2.4.RELEASE.jar
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-web-4.2.4.RELEASE.jar
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/lib/spring-webmvc-4.2.4.RELEASE.jar
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/WEB-INF/web.xml
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/index.html
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/WebContent/test01.html
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/resources
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/resources/springmvc.xml
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/src
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/src/com
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/src/com/itheima
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/src/com/itheima/web
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/src/com/itheima/web/helloworld
    Adding         F:/CODE_SPACE/SouceCode/BASE_0/itheima-02/src/com/itheima/web/helloworld/HelloWorld.java
    Transmitting file data ...
    Unknown action received: commit finalizing
    Committed revision 2.
日志信息

提交后,展示如下:


SVN的提交和更新代码
 当本地的代码发生改变的时候,需要的提交的时候,先和服务器端的代码进行同步一下。

一般都可以提交,但是一般选择提交自己修改后的代码。


Eclipse集成 Git
eclipse配置用户操作信息

配置ssh密钥。因为操作git是基于ssh协议完成的。
并将.ssh文件夹上传到linux服务器 /home/git文件夹下。


在itheima-maven项目中右键-->team-->share project-->git   此时只是链接 到本地仓库。

然后就可以将代码提交到本地,在推送到远程。


推送到远程:

现在远程的服务器上创建git仓库:git --bare init /home/git/itheima.git
  URI:ssh://git@192.168.121.132:22/home/git/itheima.git

可以将仓库名称设置为项目的名称(即itheima-maven)。以便将来检出的时候,不需要再重命名。

可能会出现的问题:

Can't connect to any repository: 
ssh://git@192.168.121.132:22/home/git/itheima.git 
(ssh://git@192.168.121.132:22/home/git/itheima.git: 
error occurred during unpacking on the remote end: unpack-objects abnormal exit)

需要.git/config添加如下代码:
  [receive]
    denyCurrentBranch = ignore

原因:
git库权限的问题
$ ls -la,查看git库的所有者
解决:
  在git库目录下:
  $sudo chown -R git:git git库(如:itheima.git)


posted @ 2019-02-05 17:26  payn  阅读(633)  评论(0)    收藏  举报