前言
在研究JPF时,发现存在两个版本的JPF,一个是在sourceforge上代码库,自2006后不再更新,但用svn签出;一个是NASA软件工程实验室自建的Mercurial版本库服务器上代码库,现在依然在开发更新,并且提供的完整的在线WIkI文档。我们使用的是NASA的.
准备材料:
- eclipse
- jpf-core
- jdk 1.8或以上
安装过程
TortoiseHg
- 如果要下载JPF的相关组件,必须要使用一个名叫Mercurial的分布式版本控制系统。通过clone从JPF的官网上clone下jpf-core的源码,链接如下:jpf-core.
- 精简版的jpf以及配置文件如下,可以直接在配置文件中修改路径使用即可下好的核心部分
- 如果需要更加丰富的组件可以在如下链接clone,在配置文件中按照jpf-core的配置方法照猫画虎即可
Eclipse中JPF插件的安装
在Eclipse的菜单中
help→installnewsoftware
插件的链接如下:
eclipse jpf plugin
Location里面填这个:
http://babelfish.arc.nasa.gov/trac/jpf/raw-attachment/wiki/install/eclipse-plugin/update/
然后一路next……..
写好的那个配置文件site.properties:
JPF site cofiguration
#以下是路径,按照你自己的放置jpf-core的路径设置
jpf-core=E:\JPF\jpf-core
extensions=${jpf-core}
Eclipse插件的设置
菜单按如下路径一直点
window→preference→JPF preference
导入jpf path finder
菜单按如下路径一路点下去
File→import→exitingproject
然后导入之前的jpf-core项目,我们来看它的构建的配置文件:
<?xml version="1.0" ?>
<!--
build.xml - the JPF core build script
using Ant (http://jakarta.apache.org/ant)
public targets:
build (default) compile classes and build JPF jar files
compile compile JPF and its specific (modeled) environment libraries
test run all JPF tests
clean remove the files that have been generated by the build process
buildinfo create buildinfo properties file
-->
<project name="jpf-core" default="build" basedir=".">
<!-- ===================== ===== COMMON SECTION ========================== -->
<!--
local props have to come first, because Ant properties are immutable
NOTE: this file is local - it is never in the repository!
-->
<property file="local.properties"/>
<property environment="env"/>
<!-- compiler settings -->
<property name="debug" value="on"/>
<property name="deprecation" value="on"/>
<uptodate property="build_uptodate" targetfile="build/main/gov/nasa/jpf/build.properties" srcfile="build.properties"/>
<!-- generic classpath settings -->
<path id="lib.path">
<pathelement location="build/main"/>
<pathelement location="build/peers"/>
<pathelement location="build/annotations"/>
<fileset dir=".">
<include name="lib/*.jar"/>
</fileset>
</path>
<!-- init: common initialization -->
<target name="-init">
<tstamp/>
<mkdir dir="build"/> <!-- the build root -->
<!-- the things that have to be in the classpath of whatever runs Ant -->
<available property="have_javac" classname="com.sun.tools.javac.Main"/>
<fail unless="have_javac">no javac was found __or__ check http://babelfish.arc.nasa.gov/trac/jpf/wiki/install/build for possible solutions</fail>
<available file="src/main" type="dir" property="have_main"/>
<available file="src/annotations" type="dir"