Ravina Somvanshi
Ravina Somvanshi

Reputation: 63

not able to import classes from jar which was downloaded from custom maven nexus repository

I have deployed my external jar to local Nexus repository. I have defined repository in setting.xml and provided dependency in POM.xml.

My project is able to download the jar in Maven dependencies , however When I tried to import any class from the that jar.

I am not able to import it. It is saying cannot be resolved to a type.

So in short I am not able to use the classes from jar which i have downloaded from local nexus repository.

Can any one help me here?

here is repository part of my Setting.xml file

  <profiles>
     <profile>
   <id>myprofile</id>
 <repositories>
   <repository>
      <id>modelhelper-repo</id>
     <name>Modelhelper repository</name>
     <url>http://localhost:8081/#browse/browse:maven-public </url>
   </repository>
 </repositories>     
</profile>
  </profiles>
  <activeProfiles>

myprofile

here is dependency from pom.xml file:

       <dependency>   
       <groupId>com.ravina</groupId>
        <artifactId>modelhelper</artifactId> 
        <version>1.0.0</version>
        <scope>provided</scope>
    </dependency>

There is Employee and other many classes in this modelhelper-1.0.0.jar, which I am not able to import in my project.

Upvotes: 2

Views: 1168

Answers (2)

Dawid Sawa
Dawid Sawa

Reputation: 2194

Your repository's URL in settings.xml doesn't seem to be correct - it looks like you've used the URL from your browser. The URL you should use is http://localhost:8081/repository/maven-public/

The repository URL can be found in Administration -> Repositories -> [repository_name]

Upvotes: 2

Dinesh Acharya
Dinesh Acharya

Reputation: 135

Scope of the dependency is provided (means will be provided by container/parent). If you want to use the dependency during compile time. Change the scope to compile.

Upvotes: -1

Related Questions