Eclipse Che安装使用

安装使用的版本是 6.16.0, 已经过时, 7 版本已经出了.

安装使用 (Ubuntu)

环境: Ubuntu 16.04

Eclipse Che GitHub | 官方文档 | 官方安装文档

文档指出运行一个默认的 Eclipse Che, 在 Docker 下仅需如下命令.

docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v <path>:/data eclipse/che start

由于 Docker 进程使用 Unix Socket 而不是 TCP 端口, 需要 sudo. cd 到一个目录, 输入:

# 指定了版本 6.16.0, 最新版总是提示 not found.
sudo docker run -it -v /var/run/docker.sock:/var/run/docker.sock -v ~/Eclipse-Che:/data eclipse/che:6.16.0 start

# 目前用的版本
sudo docker run -it -v /var/run/docker.sock:/var/run/docker.sock -v ~/Workspace/Eclipse-Che/Eclipse-Che-6.16.0:/data -v ~/.m2:/home/user/.m2 eclipse/che:6.16.0 start

倒数第二行输出 INFO: (che start): Use: http://192.168.221.133:8080 即为浏览器访问地址.

踩坑

Workspace 中不显示且无法新建项目

如图.

在这里插入图片描述

在这里插入图片描述

而正常情况应该为:

在这里插入图片描述

出现该问题的原因: 访问的地址是 localhost:8080127.0.0.1:8080, 正确应该访问本机ip+端口8080.

问题主要发生在 Windows 下, win 下终端直接提示的用 localhost 访问, 而 Linux 环境下则提示用本机ip访问所以没这个问题:

INFO: (che sstart): Use: http://192.168.221.133:8080
INFO: (che start): API: http://192.168.221.133:8080/swagger

解决方法查询自 GitHub Issue 12475:

qurben commented on 25 Feb

@skabashnyuk It seems to be related with #12476, before that CORS on wsagent was a bit more liberal.

When running the normal setup on Docker (the one described on the wiki and in this issue) and accessing Che via http://localhost:8080 the following happens:

In CheWsAgentCorsAllowedOriginsProvider the value of apiExternal is equal to http://10.0.75.2:8080/api (or whatever ip the container has on the Docker NAT). This sets allowedOrigins to http://10.0.75.2:8080. This causes the wsagent server to not respond with any CORS headers when a request is sent from http://localhost:8080 or http://127.0.0.1:8080 because the host does not match.

I am currently not well known enough with the code to propose a proper solution for this.

代码补全快捷键 (Ctrl + Space) 不起作用

症状是报错与警告正常显示, 但在编辑器按快捷键 Ctrl + Space 尝试弹出代码补全的小框框时没有反应.

解决方法: 把 Win10 输入法关了…

Maven install 报错: Found 1 non-complying files

[ERROR] Found 1 non-complying files, failing build
[ERROR] To fix formatting errors, run "mvn fmt:format"
[ERROR] Non complying file: /home/xie/Workspace/Eclipse-Che/Eclipse-Che-6.16.0/instance/data/workspaces/workspaceo7zayfpxbzrdvmqf/che-test-extension/plugins/plugin-xxx/plugin-xxx-ide/src/main/java/zzz/yyy/ide/XXXExtension.java
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Plugin XXX :: Parent pom ........................... SUCCESS [  1.921 s]
[INFO] Plugin XXX :: Plugins ::  Parent ................... SUCCESS [  0.053 s]
[INFO] Plugin XXX :: Plugin :: Parent ..................... SUCCESS [  0.816 s]
[INFO] Plugin XXX :: Plugin :: Server ..................... SUCCESS [  3.759 s]
[INFO] Plugin XXX :: Plugin :: IDE ........................ FAILURE [  2.800 s]
[INFO] Plugin xxx :: Che Assembly :: Assembly Parent ...... SKIPPED
[INFO] Plugin XXX :: Che Assembly :: Workspace Agent Assembly SKIPPED
[INFO] Plugin XXX :: Che Assembly :: Workspace Agent Tomcat Assembly SKIPPED
[INFO] Plugin XXX :: Che Assembly :: IDE Assembly ......... SKIPPED
[INFO] Plugin XXX :: Che Assembly :: Assemblies Tomcat .... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.225 s
[INFO] Finished at: 2019-07-08T10:26:53+08:00
[INFO] Final Memory: 59M/1319M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.coveo:fmt-maven-plugin:2.5.1:check (default) on project plugin-xxx-ide: Found 1 non-complying files, failing build -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.coveo:fmt-maven-plugin:2.5.1:check (default) on project plugin-xxx-ide: Found 1 non-complying files, failing build
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)

... ...

	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 20 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :plugin-xxx-ide

运行 mvn fmt:format 即可. Issue 8947.

插件开发

官网的 Demo 安装

官网的双开ide的教程复现不了 (第二个 ide 也是显示不了工作区项目的问题), 作罢. 以下是 GitHub 上找到的方法.

git clone https://github.com/che-samples/che-ide-server-extension
cd che-ide-server-extension
git checkout 6.16.0

# 用 Maven 前先换阿里云的源, 不然大概率失败
mvn clean install -DskipTests

# 启动带插件的 Eclipse Che
sudo docker run -ti --rm -v /var/run/docker.sock:/var/run/docker.sock -v ~/Check:/data -v $(pwd)/assembly/assembly-main/target/eclipse-che-6.16.0/eclipse-che-6.16.0:/assembly eclipse/che:6.16.0 start --fast

在这里插入图片描述在这里插入图片描述

(目前用的一些指令)

Docker:

# 无插件 IDE
sudo docker run -it -v /var/run/docker.sock:/var/run/docker.sock -v ~/Workspace/Eclipse-Che/Eclipse-Che-6.16.0:/data -v ~/.m2:/home/user/.m2 eclipse/che:6.16.0 start

# 测试 Plugin
sudo docker run -ti --rm -v /var/run/docker.sock:/var/run/docker.sock -v ~/Workspace/Eclipse-Che/Eclipse-Che-6.16.0:/data -v $(pwd)/assembly/assembly-main/target/eclipse-che-6.16.0/eclipse-che-6.16.0:/assembly eclipse/che:6.16.0 start --fast

# 测试本地 IDE
sudo docker run -ti --rm -v ~/Workspace/Eclipse/Maven/che-6.16.0:/repo -v ~/Workspace/Eclipse-Che/Eclipse-Che-6.16.0:/data -v /var/run/docker.sock:/var/run/docker.sock eclipse/che:6.16.0 start --fast

# 删除所有容器
sudo docker rm -f $(sudo docker ps -a -q)

Tomcat:

sudo docker run -d -v /home/xie/Workspace/Eclipse/Maven/CLDIFF-WEB/target/CLDIFF-WEB.war:/usr/local/tomcat/webapps/CLDIFF-WEB.war -p 8080:8080 --name cldiff-server tomcat

sudo docker cp /home/xie/Workspace/Eclipse/Maven/CLDIFF-WEB/target/CLDIFF-WEB.war cldiff-server:/usr/local/tomcat/webapps

sudo docker exec -it cldiff-server /bin/bash

sudo /usr/local/bin/tomcat9/bin/startup.sh 
sudo /usr/local/bin/tomcat9/bin/shutdown.sh 

Maven:

# 构建 che 整体
mvn -DskipTests=true -Dfindbugs.skip=true -Dmdep.analyze.skip=true -Dlicense.skip=true -Dgwt.compiler.localWorkers=2 -T 1C -Pnative -pl '!dashboard' fmt:format clean install -e | tee ~/Desktop/che.log


# 构建 plugin-git
cd ~/Workspace/Eclipse/Maven/che-6.16.0/plugins/plugin-git
mvn fmt:format clean install -e -Dlicense.skip=true
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值