BimServer开发环境的搭建
kagula
2018-10-17
部署环境
[1]JDK 1.8.x
[2]Eclipse Mars2 J2EE
[3]Windows 10 Pro 64bits
[4]BIM Server
用的是截止到2018年10月16日凌晨, master分支上的最新版本。
开发环境不需要Tomcat作为容器,BimServerJar自带了Jetty容器。
正文
下载代码
Step1:
本地新建
D:\workspace_java\opensourceBIM\
Step2:
下载源码
git clone https://github.com/opensourceBIM/BIMserver.git
Step3:
用Eclipse import后,发现BimServer项目中org.bimserver.interfaces.SConverter不存在的问题
查找后发现在下面的路径中
...\opensourceBIM\BIMserver\BimServer\generated\org\bimserver\interfaces\SConverter.java
BimServer项目Java Build Path->Source中add folder, 可以看到generated folder,check it
refresh project后刚才的错误提示消失。
Step4:
Description Resource Path Location Type
Plugin execution not covered by lifecycle configuration:
org.codehaus.mojo:build-helper-maven-plugin:1.10:add-source (execution: add-source, phase: generate-sources) pom.xml /BimServer
line 36 Maven Project Build Lifecycle Mapping Problem
把plugins节点注释掉, because we alread have added generated folder by manually.
下面代码被注释掉
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>generated</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Step5:
查看Markers,
我们发现有下面的错误提示
Description Resource Path Location Type
Failure to transfer org.apache.maven.plugins:maven-assembly-plugin:pom:2.2-beta-5 from
https://repo.maven.apache.org/maven2 was cached in the local repository,
resolution will not be reattempted until the update interval of central has elapsed or updates are forced.
Original error: Could not transfer artifact org.apache.maven.plugins:maven-assembly-plugin:pom:2.2-beta-5 from/to central (https://repo.maven.apache.org/maven2):
Received fatal alert: protocol_version pom.xml /BimServerJar line 1 Maven Configuration Problem
其实就是maven下载maven-assembly-plugin失败。
参考下面的代码
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-assembly-plugin -->
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
</dependency>
改成用2.2版本,问题消失。
Step6:
注释BimServerJar项目org.bimserver节点下的LocalDevBimServerStarter.java文件
LocalDevPluginLoader.loadPlugins(bimServer.getPluginManager(), pluginDirectories);
语句后的一段代码,因为这段代码会自动设置BimServer的默认参数,我们需要自己设置BimServer的默认参数
否则,访问
http://172.0.0.0:8080/apps/bimviews
你会看不到一个插件,这样的BimServer对我们来说是没用的。
Step7:
打开代理,启动BimServerJar项目中的LocalDevBimServer可以看到Jetty容器启动后开始装载BIMServer.
访问http://172.0.0.0:8080
BIMServer的Setup过程需要访问的网站只能通过代理访问。
Last Step:
訪問BIMServer的安裝界面
訪問http://172.0.0.0:8080/,根據嚮導一步一步設置。
.............
然後點擊 “Open BIMvie.ws”(http://172.0.0.0:8080/apps/bimviews/?page=Login), 訪問BIMServer的GUI。然後創建項目,然後上傳ifc文檔,然後就可以預覽BIM模型了:
Remark:
这里不建议你手动安装IfcOpenShellPlugin插件,我装上去了,解决了无数的坑,还是无法正确解析上传的ifc文件,后来试试自动安装,就装上了。
参考资料
[1]
https://github.com/opensourceBIM/BIMserver/wiki/Eclipse
[2]
https://github.com/opensourceBIM/BIMserver/wiki/BIMserver-1.5---Developers
[3]
Cannot add a project to a tomcat server in eclipse
https://stackoverflow.com/questions/15380125/cannot-add-a-project-to-a-tomcat-server-in-eclipse
[4]
Eclipse: Missing web.xml file? How can I create web.xml in Eclipse?
https://crunchify.com/eclipse-missing-web-xml-file-how-can-i-create-web-xml-in-eclipse/
[5]
Convert Java Project to Dynamic Web Project in Eclipse Environment
https://crunchify.com/convert-java-project-to-dynamic-web-project-in-eclipse-environment/
[6]
How do I change in an eclipse web project the WebContent folder to something different?
https://stackoverflow.com/questions/1581683/how-do-i-change-in-an-eclipse-web-project-the-webcontent-folder-to-something-dif
[7]
BimServer安装使用
https://blog.csdn.net/lipku/article/details/78732917
[8]
https://www.youtube.com/watch?v=Vb6gokSBA0I
[9]IfcOpenShellPlugin下载位置
https://github.com/opensourceBIM/IfcOpenShell-BIMserver-plugin.git
FQA
Q:提示无internet连接
A:
修改代码:
D:\workspace_java\opensourceBIM\BIMserver\BimServer\src\org\bimserver\webservices\impl\ServiceImpl.java
BimServer/src/org/bimserver/webservices/impl/pl/ServiceImpl.java中函数c中函数checkInternetConnection(),
注释原来的代码,直接return true;
A:
建议你不要改代码,而是使用代理解决无法访问www.google.com问题。
Q:遇到下面的错误
Installing ifcopenshellplugin...
java.net.ConnectException: Connection timed out: connect
Setup aborted
插件是下载到下面的路径中
D:\workspace_java\opensourceBIM\BIMserver\BimServerJar\tmptestdata\home\plugins
A
跳过这个插件的下载,在下面位置下载
https://jar-download.com/artifacts/org.opensourcebim/ifcopenshellplugin
下载好后,解压缩,找到ifcopenshellplugin-0.5.31.jar
在
http://localhost:8080/apps/bimviews
中,手动安装这个插件.
A 建议你不要手动安装IfcOpenShell插件,因为后面你会遇到很多问题,而且是解决一个问题,又有一个问题,后面无数的坑。
Q https://s3.amazonaws.com/ifcopenshell-builds/v0.6.0.json 无法访问问题
A 如果代理速度慢的话,
修改
IfcGeomServerClient.java
从网络读取改为从本地读取
我把
v0.6.0.json放在D分区根目录
原来的代码段
URL buildsUrl = new URL("https://s3.amazonaws.com/ifcopenshell-builds/v0.6.0.json");
JsonArray builds = new Gson().fromJson(new InputStreamReader(buildsUrl.openStream()), JsonArray.class);
修改后的代码段
JsonArray builds = new Gson().fromJson(new InputStreamReader(new FileInputStream(new File("d:/v0.6.0.json"))), JsonArray.class);
A 建议你不要改代码,还是换个高速代理原因同上。
Q IfcOpenShellPlugin项目如何打包?
A Run as maven build
如果一切顺利就会出现如下的提示信息
Building jar: D:\workspace_java\opensourceBIM\IfcOpenShell-BIMserver-plugin\target\ifcopenshellplugin-0.5.32-SNAPSHOT.jar
现在你就可以用这个jar手动安装IfcOpenShellPlugin插件了。
Q Geometry not loading
A When IfcOpenShell create the Geometry, it needs to run an executable program!
下载
https://s3.amazonaws.com/ifcopenshell-builds/IfcGeomServer-v0.6.0-5526f42-win64.zip
里面含
IfcGeomServer.exe
复制到
...\workspace_java\opensourceBIM\BIMserver\BimServerJar\tmptestdata\home\tmp\org.opensourcebim.ifcopenshellplugin
路径中即可。
A 建议你不要用这种办法,而是使用代理重新安装IfcOpenShellPlugin。
Q 前端提示
VM722:59 Uncaught TypeError: object.getGeometry is not a function
at Properties.selected (eval at globalEval (bimviews.js?_v=0.0.110:338), <anonymous>:59:11)
A 我查了下,我的BIMSurfer是0.0.45版本,后来没出现这个问题。
Q No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
A
https://stackoverflow.com/questions/19655184/no-compiler-is-provided-in-this-environment-perhaps-you-are-running-on-a-jre-ra
Q 在Eclipse中,BimServer没有出现在Tomcat那个Add and remove... dialog中
A 发现是因为BimServer project勾选了utility module引起的,check Dynamic Web Module 3.0项就可以了,但是接下去你还要设置WebContent路径,因为BIMServer项目把它设到www目录下了。