<dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.5.2</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpmime</artifactId> <version>4.5.2</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.4</version> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.2.4</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.xwiki.platform</groupId> <artifactId>xwiki-platform-rest-model</artifactId> <version>7
java.lang.Error: Unresolved compilation problems:
The import javax.servlet.ServletContext cannot be resolved
The import javax.servlet.http.HttpSession cannot be resolved
The import javax.servlet.http.HttpSessionEvent cannot be resolved
The import javax.servlet.http.HttpSessionListener cannot be resolved
HttpSessionListener cannot be resolved to a type
ServletContext cannot be resolved to a type
HttpSessionEvent cannot be resolved to a type
HttpSession cannot be resolved to a type
context cannot be resolved
context cannot be resolved
context cannot be resolved
context cannot be resolved
context cannot be resolved
context cannot be resolved
context cannot be resolved
context cannot be resolved
context cannot be resolved
context cannot be resolved
context cannot be resolved
HttpSessionEvent cannot be resolved to a type
HttpSession cannot be resolved to a type
saiku的社区版本二次开发一直以来都是比较费劲的,最近saiku社区版在新版本中,引入了license的机制,于是我选了个3.8稳定版本(release-3.8),且不需要license的版本作为基础,将代码合并在一个项目中,以简化二次开发和源码研究。
作为一个普通maven项目,可以使用eclipse部署在tomcat中,debug等各种玩耍
创建新项目saiku3
在创建的项目中,分别创建resource目录:“src/main/saiku-web”,“src/main/saiku-service”,“src/main/saiku-olap-util”,并将saiku-core下的相应代码(java目录下和resources目录下的文件)分别copy到里面,
将saiku-webapp\src\main\webapp目录下的所有文件,覆盖到新建项目的webapp目录中
将编译过后的zip包中tomcat\webapps\下的ROOT目录中文件全部copy到新建项目的webapp目录中并修改/saiku3/src/main/webapp/js/saiku/Settings.js文件中的TOMCAT_WEBAPP值为“/saiku3”
将编译过后的zip包中saiku-server目录下的data和repository文件夹copy到项目的webapp目录中
修改saiku-beans.properties文件,修改所有“../../”的地方替换为“../webapps/saiku3/”;修改saiku-beans.properties文件,修改pluginpath为“../webapps/saiku3/js/saiku/plugins/”(20160614修改)
修改eclipse中tomcat的工作路径:参考如下文章 http://blog.csdn.net/gsying1474/article/details/51597995
修改 Database.java中的init方法,注释loadEarthquakes();方法的调用,以保证代码启动(此方法的代码中有部分导致启动错误,此方法为加载demo数据,所以不会影响功能使用)
整理POM文件中的jar包依赖(比较复杂)
如果不使用maven项目,也可以将打包好的项目中jar包全部copy到lib
下面是全文检索引擎的初步应用,但是很遗憾,原生的lucene不支持中文分词,所以需要插件支持,在后面会继续讲到。
代码摘自:http://iluoxuan.iteye.com/blog/1708695
POM.xml文件:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>cn.firewarm</groupId> <artifactId>testLucene</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</
注意,IK Analyzer需要使用其下载列表中的 IK Analyzer 2012FF_hf1.zip,否则在和Lucene 4.10配合使用时会报错。
import java.io.IOException; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.StringField; import org.apache.lucene.document.TextField; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.queryparser.classic.ParseException; import