The import package cannot be resolved

2019-08-21 19:55发布

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();
    }
}

1条回答
\"骚年 ilove
2楼-- · 2019-08-21 20:55

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!!

查看更多
登录 后发表回答