Import package cannot be resolved

I have a liferay portlet. I have added some external libraries using maven. There are no errors in ide, it can recognize, but when deploying with ant, it doesn't talk about this 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();
    }
}

      

0


source to share


1 answer


If you are using maven and you have defined your scoped dependency as a system or have provided a similar system or provided> then it will not be included in the war file generated during deployment or package.

If you have a third party jar on your local machine and you want to include them in your war file then install this jar file in your local repository and remove the scope from the pom.xml then while maven package will include this jar file in your war and you won't get any errors when deploying

The command to install the 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!

0


source







All Articles