Existing Bugs and Issues with Maven and OSB 12.2.1.2 and How to Fix Them
It is a well known fact that Maven in OSB 12.2.1.1 came with glitches that required manual fixes as described in Robert Patrick’s blog posting and in the Oracle support notes Doc ID 2186338.1. However, this article is centered around the latest OSB 12.2.1.2, its particular Maven issues and how to fix them. Same as version OSB 12.2.1.1 also 12.2.1.2 suffers from various maven glitches, however in a more subtle way.
[Note, that I usually don’t post references to MOS, since not everybody has access to it. Anyway, if you cannot access to Doc ID 2186338.1 don’t worry. It basically describes what Robert writes about in his blog. In addition it recommends actually not to fix it manually, but instead wait for a patch. I actually I agree. Also note that as of OSB 12.2.1.2 this issue is not marked as fixed although the behavior of the newest version is different.]
The current situation with OSB 12.2.1.2 and Maven is “interesting”, to put it mildly:
- mvn with OSB 12.2.1.2 and the maven push plugin only will not work out of the box. This means the official documentation won’t help you in this case. The good news – despite the fact that mvn with OSB 12.2.1.2 is not working correctly – is that it is rather easy to fix manually (see below, Fix 1: Maven with OSB 12.2.1.2 and the mvn push plugin).
- Also mvn with OSB 12.2.1.2 and maven.oracle.com will not work (as of Jan 7, 2017). Since the required .pom and .jar files are pulled over from maven.oracle.com and several of them are missing it is obviously not easy to fix it yourself.
- Here comes the crazy part (well, crazy on an IT scale): if you configure both, i.e. first use the OSB Maven plugin to push from an OSB 12.2.1.2 ORACLE_HOME into the .m2 repository, and then in addition configure the maven.oracle.com repository, then it is done twice. Yet then also both issues cancel each other out.
Here are the fixes, as promised
Fix 1:Maven with OSB 12.2.1.2 and the mvn push plugin
a) easy manual fix, updating two lines in two files:
After usign the push plugin, in .m2 Repository, e.g. D:\Users\frank\.m2\repository\com\oracle\servicebus\sbar-system-common\12.2.1-2-0 change the file sbar-system-common-12.2.1.2.pom as follows:
under
<parent> <groupId>com.oracle.maven</groupId> <artifactId>oracle-common</artifactId> <version>12.2.1-1-0</version> </parent>
change the version tag to <version>12.2.1-2-0</version>
also for the file sbar-project-common-12.2.1.2.pom in the directory
.m2\repository\com\oracle\servicebus\sbar-project-common\12.2.1-2-0 change the version number the same way.
b.) Install patch 22392646
This is the second, alternative option to fix the issue. Install patch 22392646 from My Oracle Support. After a lengthy and tiring discussion I had with support it is now also applicable to OSB 12.2.1.2. – voilà! Depending on your provisioning approach this might be the easier fix, but actually you could just copy over the files (or even run sed on those two files).
Issue 2: Maven with OSB 12.2.1.2 and the maven.oracle.com
There is no known fix at the moment, maven.oracle.com is missing a whole lot of files (again) and also some of those delivered are wrong again. Bug 23698828 describes a very similar issue, yet reports it as fixed for 12.2.1.1. Oracle support knows about it, so let’s hope it will be fixed soon in maven.oracle.com. I will keep you posted, promised.
Update: After the first round with support their “solution” did not work. The issue is still not fixed. If you think about it for a second, how hard can it be to push a patched .m2 repo to maven.oracle.com? Stay tuned 🙂
To conclude
You are lucky if you simply retyped all the instructions available and configured both ways to use Maven with OSB 12.2.1.2 (although I somehow guess you would have not read this article then).
As soon as you follow a clear path and either go for the push plugin on a machine with OSB installed, or maven.oracle.com on a build server without an OSB installation, you will run into issues. It is obvious that Oracle would do good with automatically testing this functionality for future releases. Not being able to browse the maven.oracle.com repo makes it more difficult for customers to debug those issues, so it might be a good idea to use a local proxy / cache.
Let me know your feedback!
Another point to be aware of is that even when you added all the JARs to the local maven repostiory, you still need to have the OSB software tree to be able to run “mvn package” on an OSB project. I found this surprising, and it complicates the setup of CI for OSB: you still need to install OSB on your Jenkins server or build slave.
Would be much better if the maven build (i.e. underlying configjar tool) would get the required libraries from the maven repo…