0 0

maven导入一个jar包的问题5

各位帮忙看看,万分感谢
我有一个IKAnalyzer3.2.8.jar,普通的jar包
需要导入到一个项目中mahout
在pom.xml中加入
<!--kenny-->
   
Java代码  收藏代码

    <dependency> 
           <groupId>org.wltea</groupId> 
           <artifactId>IKAnalyzer</artifactId> 
            <version>3.2.8</version> 
             <scope>system</scope> 
             <systemPath>/home/hrkjsoft01/Documents/IKAnalyzer3.2.8.jar</systemPath> 
         </dependency> 



执行 mvn clean install没有报错
但执行代码时出错
java.lang.ClassNotFoundException: org.wltea.analyzer.lucene.IKAnalyzer
请指教,谢谢
2013年5月14日 14:47

6个答案 按时间排序 按投票排序

0 0

采纳的答案

systemPath 的目录下是否有IKAnalyzer3.2.8.jar
还有一个疑问,为什么要使用system这个依赖范围呢

2013年5月14日 17:14
0 0

创建个artifactory,下载个war包,运行起来,然后把你的jar丢上去

2013年5月15日 12:20
0 0

帮你找到原因了,参考http://maven.apache.org/pom.html

systemPath:
is used only if the the dependency scope is system. Otherwise, the build will fail if this element is set. The path must be absolute, so it is recommended to use a property to specify the machine-specific path (more on properties below), such as ${java.home}/lib. Since it is assumed that system scope dependencies are installed a priori, Maven will not check the repositories for the project, but instead checks to ensure that the file exists. If not, Maven will fail the build and suggest that you download and install it manually.

The path must be absolute, 路径必须是绝对路径的;

2013年5月15日 09:35
0 0

你确定 systemPath 的目录下 有IKAnalyzer3.2.8.jar

2013年5月14日 17:11
0 0

这得看你运行在什么环境下了。在你项目运行环境下的lib目录下有没有这个jar包,没有可能就报错了。
maven编译时依赖的是你本地的maven库里的jar包,所以编译能通过。、

2013年5月14日 15:29
0 0


buildpath的问题?

2013年5月14日 14:50

相关推荐

Global site tag (gtag.js) - Google Analytics