Maven Oracle artifacts pom dependencies configuration - java

I have a Java maven project on which I'm currently working on that requires an Oracle weblogic dependency for Weblogic full client (wlfullclient.jar).
I know that there is a brand new Oracle Maven repository (that is in fact already proxied by our Nexus) but unfortunately it is not browsable.
Where can I find the right dependency information in order to insert it in my project pom in terms of GAV parameters (Group ID, Artifact, Version)?
Is this information published anywhere?
At the moment, as a temporary workaround, I got this library from the Oracle Weblogic 12c server and put in into a 3rd party hosted repository on my Nexus.

I finally managed to find a site which mirrors Oracle Maven index, so I've been able to find out the right dependencies GAV parameters I have to use in my poms.
A couple of examples:
<dependency>
<groupId>com.oracle.weblogic</groupId>
<artifactId>wlfullclient</artifactId>
<version>12.1.0.1</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.1</version>
</dependency>
Notice that this index site seems quite up-to-date since it contains artifacts pertaining to version 12.1.0.2 and some of them have been updated on September 14th.

Looks like they are not having a browser viewable list - https://community.oracle.com/thread/3650312 .

you should use repository browser provided by Netbeans. See here
https://blogs.oracle.com/WebLogicServer/entry/oracle_maven_repository_index_now

Related

How to make my dependency available to other developers?

I recently created my own API in maven, and I need to make the dependency available to others. I have tried using the dependency in another project, but it can't find it. What do I need to do in order to publish it?
My dependency:
<dependency>
<groupId>org.dec4234</groupId>
<artifactId>JavaDestinyAPI</artifactId>
<version>1.0</version>
</dependency>
Available on GitHub
You need to upload your library to a Maven repository. By default, every Maven project uses the Maven Central repository - which contains copies of most common publicly available libraries that you are probably used to using by just putting an entry in the <dependencies> section of your pom.xml.
Here is a guide to uploading a library to Maven Central - https://central.sonatype.org/pages/ossrh-guide.html. I've personally used it previously and whilst it does take some work, its probably your best option.
You can also host your own Maven repository, but I'll leave detailing that route to someone else's answer.

Maven dependencies for IBM Websphere packages

I'm trying to convert a "classic" JAVA EE project, using IBM websphere 8.0.0.5, into a maven multi module project and facing issues with the IBM dependecies.
We use IBM classes from the following packages:
com.ibm.websphere.asynchbeans
com.ibm.websphere.scheduler
com.ibm.websphere.ce.cm
com.ibm.ws.asynchbeans
com.ibm.ws.util.ThreadPool
To get my local project to be compiled I downloaded the was.installer-8.0.0.pm from IBM and installed it to my maven using
mvn install -f "was.installer-8.0.0.pom" -D serverInstallationFolder="C:\Program Files (x86)\IBM\WebSphere\AppServer"
This step was successfull according to command line output.
I then added the following dependencies to my project as described from IBM:
In parent:
<dependency>
<groupId>com.ibm.tools.target</groupId>
<artifactId>was</artifactId>
<version>8.0.0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
In module:
<dependency>
<groupId>com.ibm.tools.target</groupId>
<artifactId>was</artifactId>
</dependency>
But I still can't compile my project as the IBM packages are not found.
Can anyone help me to find and correct a mistake I made?
Edit
After following BevynQ tip from the comments I copied the "was_public.jar" to "was_public-8.0.0.jar" (described at IBM here) and added it to my repository:
mvn install:install-file -Dfile="C:\Program Files (x86)\IBM\WebSphere\AppServer\dev\was_public-8.0.0.jar" -DpomFile="C:\Program Files (x86)\IBM\WebSphere\AppServer\dev\was_public-8.0.0.pom"
I then changed the dependencies to:
<dependency>
<groupId>com.ibm.websphere.appserver</groupId>
<artifactId>was_public</artifactId>
<version>8.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.ibm.websphere.appserver</groupId>
<artifactId>was</artifactId>
</dependency>
This helped to get the compiling errors for the imports to com.ibm.websphere done.
What I now have still open is the packages com.ibm.ws.* package. Anyone have an idea?
Edit 2
I added the following dependency and then I was rid of the com.ibm.ws.* import errors.
<dependency>
<groupId>com.ibm.websphere.ws</groupId>
<artifactId>com.ibm.ws.runtime</artifactId>
<version>1.0.0</version>
</dependency>
But it still does not compile as now indirectly references can not be found (in my case commonj.work.WorkManager). It seems I need to add further .jars for every single thing. Isn't there an easier way to provide all websphere jars at once as descirbe in the above linked tutorial with the com.ibm.toolsdependency (which do not work)?
In general, com.ibm.websphere are public API for use by applications (this is true of the packages you listed above) which is consistent with these being in was_public.jar
However, com.ibm.ws package is generally product internals. May I ask what interface methods you are using from the com.ibm.ws.asynchbeans package? Maybe there is a public API alternative.
Regarding commonj.work, the only place I can find this in the WebSphere Application Server product image is WAS/plugins/com.ibm.ws.prereq.commonj-twm.jar so it looks like you will need to use that to compile against.
Here's the solution so I solved my dependency problems:
I configured the company repository manager (nexus) as a mirror. In this nexus all ibm packages are present. As you can think that solved the main problem.
I then added the following dependencies according to common maven style:
Dependencies in pom.xml (version numbers extracted to properties):
<dependency>
<groupId>com.ibm.websphere.ws</groupId>
<artifactId>com.ibm.ws.runtime</artifactId>
<version>${ibm.ws.runtime.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.ws.prereq</groupId>
<artifactId>commonj-twm</artifactId>
<version>${ibm.ws.prereq.commonj-twm.version}</version>
</dependency>
Sorry I can't provide a "nice" solution that's useable by all people but the answer from njr and the comment from BevynQ helped at lot to get clearer with the problem and helped to solve the problem in a "more manual" way by copying the needed jars by hand.
I was facing this issue as I tried to build a project using Maven version 3.3.9, running on Java version 1.8.0_101, as depicted in the screenshot:
This is how I resolved it: Step 1. Download the commonj.jar from here.
Step 2. Determine which JDK your Maven is using by typing mvn -version in the command prompt.
Step 3. Go to that directory and place the commonj.jar file there in the jre/lib/ext directory, as shown below. Now your project should build in maven without any issues.

iText version 4.2.1 redirected in maven central repository

We're using iText in one of our projects to generate PDF reports, precisely the version 4.2.1 because it is the last free version.
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>4.2.1</version>
</dependency>
When I cloned the repository on an new machine this morning, I faced a lot of compiler errors, because maven redirects to version 5.5.6 and the imports are failing. On our research, we found out, that the pom-file in maven central was changed last week. From now on, it seems to be impossible to add the jar dependency like we did before.
Can anyone tell me, if there is still a way to integrate iText in version 4.2.1 via maven?
As documented here, the people who published the iText forks versions 4.x.y didn't follow the rules as explained by Apache:
I have a patched version of the foo project developed at foo.com, what groupId should I use?
When you patch / modify a third party project,
that patched version becomes your project and therefore should be
distributed under a groupId you control as any project you would have
developed, never under com.foo. See above considerations about
groupId.
They published an unofficial version of iText using a groupId that led people to believe that they were using an original version of iText, which was not the case. This error has caused much confusion and frustration.
To stop the confusion, iText Group has reclaimed the groupId so that no third party can introduce software that infringes third part rights or even malware into your code base (this is a risk you take when you allow Maven to automatically upgrade).
Your allegation that iText 4.2.1 is the last free version is incorrect. There are some serious issues with iText versions prior to iText 5, but that's another discussion and the subject of a conference talk at JavaOne 2015 entitled IANAL: What Developers Should Know About IP and Legal.
In any case, the easiest solution is for you to change the dependecy to:
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>[1.02b,2.1.7]</version>
<scope>compile</scope>
</dependency>
See this answer in answer to Dependency error in jasper-reports from itext for even more background information.
First solution
You can download the jar locally and then install it locally with the following command.
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id>
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
Use groupId, artifactId, version and packaging you like.
In this case:
mvn install:install-file -Dfile=itext.jar -DgroupId=com.lowagie
-DartifactId=itext -Dversion=4.2.1 -Dpackaging=jar
Second solution:
You can also download the jar locally and reference it with the following dependency group
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>4.2.1</version>
<scope>system</scope>
<systemPath>/PATHTOJAR/itext.jar</systemPath>
</dependency>
I know this is an old thread, but I'd just cleared out my .m2 folder due to some random issues, and unfortunately then got "The artifact com.lowagie:itext:jar:4.2.1 has been relocated to com.itextpdf:itextpdf:jar:5.5.6".
Just came across this here while trying to remember how we fixed, so thought I'd post solution we had to stop it trying to upgrade.
Goto %UserProfiles%\.m2\repository\com\lowagie\itext\4.2.1\
Edit the itext-4.2.1.pom and remove the following section from the bottom and it won't bother you again and you can happily use 4.2.1 :-
<distributionManagement>
<relocation>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.6</version>
<message>After release 2.1.7, iText moved from the MPLicense to the AGPLicense.
The groupId changed from com.lowagie to com.itextpdf and the artifactId from itext to itextpdf.
See http://itextpdf.com/functionalitycomparison for more information.</message>
</relocation>
</distributionManagement>
I had the same problem using Gradle.
In my build.gradle file, under dependencies,
compile 'com.lowagie:itext:4.2.1'
would fetch itextpdf-5.5.6.jar
Running the command
gradle myapp:dependencies
would show a transitive dependency like this:
\--- com.lowagie:itext:4.2.1
\--- com.itextpdf:itextpdf:5.5.6
My solution was to upload a copy I had of the original itext-4.2.1.jar to our Nexus repository and give it a different version number.

Websphere maven dependencies

I want to create bean which will integrate with WOLA (integration with COBOL).
In order to do so I need annotate bean by #RemoteHome(com.ibm.websphere.ola.ExecuteHome.class). However this is IBM artifact which should reside in ola_apis.jar.
Do you know how can I resolve this dependency? How to add it to pom? I'm searching for some IBM repository but cannot find any.
My understanding is that for creating EAR for Websphere I should be able to create simple maven project in Netbeans.
IBM provides the APIs required for the Liberty profile in an IBM hosted maven repository. The maven repository is here. Once your maven can find this repository for the WOLA API you would want to use the following in your pom:
<dependency>
<groupId>com.ibm.websphere.appserver.api</groupId>
<artifactId>com.ibm.websphere.appserver.api.zosLocalAdapters</artifactId>
<version>1.0.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
Technically these are the Liberty profile APIs, but in this case they APIs are common between liberty profile and full profile so there shouldn't be a problem using it.
You can either include the dependency as system scope in your POM (however, this is not recommended), or you take the JAR file and upload it in a custom Maven repository within your company (or at least install it in your local repository). You can choose the group and artifact id as you want, when you do that.
Since those JARs are part of WebSphere, which has a proprietary license, there is no public Maven repository, where you could download it.

Add all artifacts from JBoss Maven repo to Maven project in Eclipse

I'm using JBoss EAP 6.0.1 (NOT JBoss AS 7.1.1 or 7.1.3!) and I'm just starting with a Maven project.
In normal Eclipse projects I set the target runtime of my project to the JBoss EAP server runtime and then all its libraries are available to my project. Available here means I can use e.g. ctrl-t to find a class in any of those libraries, and when I attach the source I can step into them when debugging.
How would I do this using Maven (m2e)?
I've found the Maven repository for JBoss EAP 6.0.1 at http://maven.repository.redhat.com/techpreview/eap6/6.0.1/
Do I need to add some root dependency (representing JBoss EAP itself) to my project, and if so, what would this dependency be?
I found a very similar question here: Adding JBoss AS 7 modules on Eclipse using Maven or JBoss Tools
But the accepted answer only says: "Take a look at these links", which doesn't tell me how to exactly do this (and it's for AS 7.1.1 not for EAP 6.0.1).
UPDATE
I wasn't entirely clear about the question. I'm not looking for a mere reference to the Java EE APIs. I know how to do that, as it's simply:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>1.6</version>
<scope>provided</scope>
</dependency>
I'm also NOT looking for any vendor versions of that spec jar. I'm absolutely NOT looking for the following one either:
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
</dependency>
What I'm looking for is having all implementation libs available in the project. The JBoss AS 6 server runtime does this by default, and with the JBoss AS 7/EAP 6 server runtime you can do this by going to Server -> Runtime Environments -> Default Classpath (you can enter individual paths there, or just add the /modules rootpath to have everything at one)
I'm looking for the equivalent of this in a Maven project.
I'M NOT LOOKING FOR SPEC JARS!!!!
As I need to step through the ACTUAL IMPLEMENTATION jars of the target server, I REALLY need the ACTUAL IMPLEMENTATION jars. I KNOW I can't deploy these, and nor do I intend to deploy them. They need to be present in my IDE, so there's source code that matches what's in the target JVM and I can use CTRL-SHIFT-T to lookup IMPLEMENTATION classes and CTRL-CLICK to navigate into them, analyse call hierarchies, etc.
AGAIN: I'M NOT LOOKING FOR SPEC JARS!!!!
You can import the dependencies manually into your repository. I did it into ours (artifactory) and it's working.
See: https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Development_Guide/Install_the_JBoss_Enterprise_Application_Platform_6_Maven_Repository_Locally.html
I found a surprisingly simple solution my self: even though libs are managed via Maven, and a target runtime is disabled by default, you can still explicitly select a target runtime.
The libraries this target runtime puts on the classpath will now also be put on the classpath for the Maven project, in addition to those Maven already puts there. You can (manually) attach the source code to those libraries.
Once you're doing with debugging and stepping through the internals of your AS, you can simply remove the target runtime again.
An answer that tells how to do this purely via Maven and for JBoss EAP 6.0.1 (not JBoss AS 7.1.1 or 7.1.3) would still be welcome, so I won't accept my own answer ;)
There is a nice explanation of the JBoss Maven repositories at: https://community.jboss.org/wiki/MavenRepository
I would guess the repository you need to use is: https://repository.jboss.org/nexus/content/groups/public-jboss/
it should contain all JBoss artifacts you're looking for.
Maybee the groupId/artifactId is not correct. There is a search feature for the repositories at: https://repository.jboss.org/nexus/index.html#welcome
I would recommend to not include the impl jars as you cannot deploy them anyway. So the spec jars should be ok:
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
</dependency>
see: http://www.andygibson.net/blog/quickbyte/jboss-java-ee-6-spec-dependency-in-maven/
The gav for the JBoss server seem to change a lot. JBoss 7 can be found at:
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-ee</artifactId>
<version>7.1.3.Final</version>
</dependency>
Take a look here:
JBoss Enterprise Application Platform Component Details
And in my pom.xml I'm using this to get dependencies from Jboss EAP 6.0.1
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<type>pom</type>
<scope>provided</scope>
<version>3.0.2.Final</version>
</dependency>
You can use Nexus or Git or Overlord to manage project artifacts in order to create a proxy virtual dependency, if i am not mistaken.
Runtime artifacts can be used:
<!-- https://mvnrepository.com/artifact/org.jboss.bom/eap-runtime-artifacts -->
<dependency>
<groupId>org.jboss.bom</groupId>
<artifactId>eap-runtime-artifacts</artifactId>
<version>7.1.0.GA</version>
<type>pom</type>
<scope>import</scope>
</dependency>
See https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.1/html/development_guide/using_maven_with_eap#manage_project_dependencies

Categories

Resources