进口包不能得到解决 [英] The import package cannot be resolved

查看:211
本文介绍了进口包不能得到解决的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Liferay的portlet的。
我已经添加使用maven一些外部库。
在IDE没有错误,它可以识别,但
蚂蚁在部署的时候,它说没有这样的包和类

 进口pack.SomeClass;
进口包不能得到解决

code:

 进口pack.SomeClass;
公共类MainPortlet扩展MVCPortlet {
    公共无效的doView(RenderRequest中的RenderRequest,的renderResponse的renderResponse){
        SomeClass的一个=新SomeClass的();
    }
}


解决方案

如果你正在使用Maven和你定义了你的依赖与范围,因为系统或提供likeSystem或提供>,那么它不会被包含在war文件的部署产生或包。

如果您对当地的第三方罐子,要它们包括在战争文件,然后该jar文件安装到你的本地库,并从pom.xml中删除然后范围而封装行家将包括jar文件到你的战争,你没有得到有关部署任何错误

命令在本地系统信息库安装JAR

  MVN安装:安装文件-Dfile = C:\\ kaptcha- {}版本的.jar -DgroupId = com.google code
-DartifactId = kaptcha -Dversion = {}版本= -Dpackaging罐子

希望它可以帮助!

I have a liferay portlet. I've added some external libraries using maven. In ide no errors, it can recognize, but when deploying with ant , it says no such package and class

import pack.SomeClass;
The import pack cannot be resolved

code:

import pack.SomeClass;
public class MainPortlet extends MVCPortlet {
    public void doView(RenderRequest renderRequest,RenderResponse renderResponse) {
        SomeClass a = new SomeClass();
    }
}

解决方案

If you are using maven and you have defined your dependency with scope as system or provided likeSystem or provided> then it will not be included in war file generated on deployment or package.

If you have third party jar on local and you want to include them in your war file then install that jar file to your local repository and remove scope from pom.xml then while package maven will include that jar file to your war and you not get any error on deployment

Command to install jar in your local repository

mvn install:install-file -Dfile=c:\kaptcha-{version}.jar -DgroupId=com.google.code 
-DartifactId=kaptcha -Dversion={version} -Dpackaging=jar

Hope it helps!!

这篇关于进口包不能得到解决的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆