supriya
supriya

Reputation: 1

How to handle the dependencies which are not present in the maven/spring repository?

I have an application whose dependencies are being handled by maven.I need to know, how can i handle the dependencies which are not present in the remote repository. I dont want to use a local repository. Need help.

Upvotes: 0

Views: 362

Answers (4)

Mark O'Connor
Mark O'Connor

Reputation: 77961

If you don't want to use a local repository then perhaps you could declare them with a system scope. Documented here

Example:

<project>
  ...
  <dependencies>
    <dependency>
      <groupId>javax.sql</groupId>
      <artifactId>jdbc-stdext</artifactId>
      <version>2.0</version>
      <scope>system</scope>
      <systemPath>${java.home}/lib/rt.jar</systemPath>
    </dependency>
  </dependencies>
  ...
</project>

I would really recommend using a local repository. Very easy to setup and install Nexus. The system scope is really designed to include extensions to the JVM.

Upvotes: 0

Prabhjot
Prabhjot

Reputation: 704

By default maven-compiler-plugin uses java 1.3 for compilation. You would need to configure it to use jdk5/jdk6. Add following to POM xml.

<build>
<plugins>
    <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
</plugins>
</build>

Upvotes: 0

Raghuram
Raghuram

Reputation: 52645

When you say

the dependencies which are not present in the remote repository

I assume you mean repositories not present in maven central (the default repository). If so, as Stephen suggested, you would want to add a repositories section in your pom with a reference to other repositories which has the dependencies.

If there are no remote repositories which has your dependencies and you do not want to install them locally to your local repository, then maven will automatically handle this situation - it will given an error and fail to build.

Upvotes: 0

Stephan
Stephan

Reputation: 43013

I can see a few solutions :

  1. Find another remote repository having the dependencies you need (jarvana, findjar etc) are your friends

  2. Wait for the maintener of the dependencies make them available on a remote repository (close your eyes, cross your fingers ... and wait)

  3. Setup your own remote repository with the dependencies you need (oragnization repository)

  4. Put your dependencies in your calsspath manually or through your favorite IDE :p

Upvotes: 1

Related Questions