WebLogic client jar

Peter Penzov picture Peter Penzov · Dec 15, 2015 · Viewed 11.7k times · Source

I want to use Java with JMX to monitor WebLogic. I need to use wlclient.jar which is provided into WebLogic lib directory.

Is there any maven repository which I can use to download the wlclient.jar? The only way that I found is to manually import the jar file into my repository but this is not a option for me.

Answer

Ashutosh Jindal picture Ashutosh Jindal · Dec 15, 2015

Another alternative is to create an in-project repository. This makes your project truly portable. This method is similar to the 'Use Dependency with system scope' mentioned by A. Di Matteo, except that it has the added benefit of being able to use any scope (and not just 'system').

I had the same issue as you, using a jar which was not available in Maven Central and after exploring all of the possible options, I settled on the in-project repository which I believe is better that system-scoping a dependency since it frees you to choose the scope.

Steps to do this:

  1. Create a sub-directory called 'lib' in your project

  2. Add this lib as a repository in your pom

<repositories>
    <repository>
        <id>lib</id>
        <name>In Project Repo</name>
        <url>file://${basedir}/lib</url>
    </repository>
</repositories>
  1. Install the artefact to your lib directory:

mvn install:install-file -Dfile=myArtifact.jar -DgroupId=x.y.z -DartifactId=${artifactId} -Dversion=${version} -Dpackaging=jar -DgeneratePom=true

  1. And, finally use the dependency like you would use any other dependency
<dependencies>
    ....
    <dependency>
        <groupId>x.y.z</groupId>
        <artifactId>${artifactId}</artifactId>
        <version>${version}</version>
    </dependency>
</dependencies>