Domanda

I was having a dynamic webapplication created on eclipse. I converted it to a maven project using M2E plugin. I added maven war plugin in the pom.xml so that it can create war for my project using maven build.

But when I do the build, it fails to compile few classes which has reference to the jars of my webapp/Web-INF/lib folder. These jars I can't include as dependency in pom.xml.

How can I tell maven to include Web-INF/lib jars also while building classes and creating a war?

È stato utile?

Soluzione

Its not correct way of doing this , you should not put any jar manually in WEB-INF/lib folder.

And if that jar is not available in MAVEN CENTRAL REPO , then you can download it and install it in your NEXUS CENTRAL REPO (if you have any) otherwise put that jar in your local maven repository and add it as a dependency in your pom file. If you don't want to include that jar in your WEB-INF/lib then change the scope to provided otherwise leave it as default i.e compile.

During build time MAVEN will look for that particular jar in your local repo first , and if it don't find it there then it try to download from Centra Repo.

Once it is available in your local repo , your build won't break.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top