Websphere maven dependencies - java

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.

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.

Adding ojdbc to maven project

I'm creating a custom document library action in Alfresco Content Services 6.1.1 using alfresco-amp-archetype. I'd like to access data from external Oracle database.
I'm using ojdbc library from: https://mvnrepository.com/artifact/com.oracle.jdbc/ojdbc8/12.2.0.1
Since maven is unable to download the dependency on its own, I'm putting the jar in my project and adding it in pom (I've also added it in tomcat/lib directory):
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ojdbc</artifactId>
<version>8</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/ojdbc8-12.2.0.1.jar</systemPath>
</dependency>
When I call the action I'm getting "java.sql.SQLException: No suitable driver found for jdbc:oracle:thin"
How should I add the driver to my project for it to work?
The system scope that you are using is more meant to include things provided by java itself and is a deprecated feature.
The jar is not in the usual maven repositories due to license restrictions. So it needs to be somewhere with private access.
If you are not running a maven repository proxy like sonatype nexus or jfrog artifactory I would recommend that you copy the jar into your own maven repository: maven deploy into local repository
(probably best in a little script to repeat or share).
Don't store it in src/main/resources - everything in there will be added into the artifact you create. Choose another folder (like "dependencies" beside src) and then once copied into your local maven repository use that jar as normal dependency (remove scope and systemPath). The default scope is compile, so the jar will be included in your classpath so the driver should then be available (I assume you create some sort of war file?).
So there is also no need to manually add it into tomcat directly - but have it brought in via the war file.

RabbitMQ Server bundle distribution: Maven pom configuration

My requirement is, like, I have to download rabitmq-server for linux environment.
But, it will be downloaded, by my maven project, using maven-dependency-plugin.
So, I have to add the rabbitmq-server artifact details as a dependency, in my project POM.
Therefore, my question is, Is it possible?
If yes, then what is the POM dependency config for that?
The maven artefact you'd need would be:
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>3.5.6</version>
</dependency>
You can find many Maven dependencies on MvnRepository.
In order to use RabbitMq, you will have to download the server itself from the RabbitMq website and run the server, as described in their documentation.

Maven Oracle artifacts pom dependencies configuration

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

How to add javax.* dependencies in Maven?

I am getting tired of manually installing javax jar files in Maven and would like to know what is the best solution to include a dependency on javax.cache, javax.transaction, or other JSRs that are not easy to find in Maven repositories.
Have you seen https://people.apache.org/~ltheussl/maven-stage-site/guides/mini/guide-coping-with-sun-jars.html ?
This link suggests groupID and artifactID's to use, as well as a java.net repository.
It looks to me like almost all of these exist in the central Maven repository under this naming scheme.
I'm not aware of one, but adding the java.net repository may help you with some of these dependencies:
<repositories>
<repository>
<id>java.net repository</id>
<url>http://download.java.net/maven/2</url>
</repository>
</repositories>
If building on more than one box and/or for team development, a local (intranet) maven repository manager can help with these "missing" jars. This centralizes the configuration and management of not only 3rd party jars that are not in a public repository, but also all external repositories in general. It could also help automate your builds, creating more 'reproducable' builds (e.g., if you have a pool of continuous integration servers).
install a mvn repo mgr (see list -- imo, nexus is really simple to start with);
use a custom settings.xml that includes a "mirrors" section pointing to your intranet mvn repo mgr. Either update your ~/.m2/settings.xml, or run maven with "mvn -s etc/settings.xml"-- useful for hudson builds, where you don't want a custom per-user settings.xml;
manually upload your 'problem' jars to your internal repo (again, super-simple w/ Nexus via a web-interface);
set up the internal mvn repo mgr as a "mirror" of repo1.maven.org/maven2, codehaus, java.net, ... (etc).
Now, you can centrally define all 3rd party repositories & 3rd party jars -- rather than requiring each person, each box and/or each project define them individually in their pom or settings.xml. Each project / person / box would ONLY define your central, internal maven repo as the single repo for all maven projects.
This also really speeds up your artifact re-download time for fresh builds, or for those times when you need to (or would like to) delete your local ~/.m2/repository cache.
Repo managers: nexus, archiva, artifactory... e.g.,: maven.apache.org/repository-management.html
- http://docs.codehaus.org/display/MAVENUSER/Maven+Repository+Manager+Feature+Matrix
javax.cache are in jcache:jcache:1.0-XXX artifact (in Maven's central repo)
<dependency>
<groupId>jcache</groupId>
<artifactId>jcache</artifactId>
<version>1.0-dev-2</version>
</dependency>
javax.transaction.* classes are in javax.transaction:jta:1.1 artifact, JTA jar can’t be inserted in the Maven repository because the Sun’s Binary License (I know, this sucks). To use it you need to download manually the JAR (it's free) and put it into a local repo or use 1.0.1B version which is contained in java.net.
NOTE: I've read in some place JTA will be integrated in future versions of the JDK
I know is really a pain to find these artifacts in Maven's repositories but you can make a search of a class in www.mvnrepository.com and it will show you the correct groupId and artifactId for mostly all the packages.
In the particular case of JTA, I hit this post:
http://www.jugpadova.it/articles/2005/11/26/maven-2-spring-and-jta-depencies
.. which makes sense, if I didn't have to spend a lot of time in Oracle's horrible site to get the forementioned JAR file. (I was an Oracle's enthusiast myself but that site could use a lot of UX rework here and there).
I decided to replace the dependency with what Hibernate provides, via Geronimo, as per this post (worked perfectly):
https://forum.hibernate.org/viewtopic.php?p=2420836
The deal with Java licensing and Maven is currently being worked on by the Hibernate team, or so it seems here:
https://hibernate.onjira.com/browse/HHH-4548
Thanks to everyone for sharing!

Categories

Resources