Reputation: 5126
I am trying to create a maven project. I added the dependencies as jar files and importing them in my class. But the class doesn't recognize it.
I tried a couple of options and serached but couldn't resolve. Please guide.
Attached below is the screenshot of my project str
Upvotes: 0
Views: 2086
Reputation: 442
Try this:
Right click your project and select maven
then click update project
. Select the project and select force update of snapshots/releases
option. Then refresh the project and build it (if you do not see compilation error
after updating).
Upvotes: 1
Reputation: 1567
Since the jar is not under web-inf folder you are seeing this error. There are several ways to resolve this issue
add below profile
<profile>
<id>qa</id>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Dependencies directory created in target folder
mvn install dependency:copy-dependencies
Upvotes: 0