I need to use Apache CXF and Maven in my current project.
When I downloaded CXF from the Apache site I noticed a set of Jars in the distribution.
But when I added the cxf-rt-frontend-jaxws dependency to pom.xml and issued an mvn package command, the lib folder had some different files, for e.g.
cxf-api-2.2.7.jar
What is the difference between the 2 distributions (if there is one)?
In general, the downloaded distribution is not needed at all if using Maven. The downloaded distro does provide some useful examples, etc... that can be helpful, but to build applications, you don't really need it.
The lib dir in the download, however, uses the "cxf-bundle" jar (renamed to just cxf-VERSION.jar) instead of the individual jars. If you use maven, you likely will use the individual modules (like cxf-rt-frontend-jaxws). You can delete the lib/cxf-VERSION.jar and copy all the jars from modules/*.jar to lib and pretty much accomplish the same thing with the download. Thats just a BUNCH of jars though.
Note: you really should use CXF 2.6.2, not 2.2.7. 2.2.x is unsupported and has various security issues with it that are fixed in the newer versions.
Related
I am in a bit of a jam.
I am working on upgrading our software to have Kettle 6.1. Specifically, we need the feature of S3FileOutput. Meanwhile, our application was already using the aws-sdk for other things.
So I am running into a problem: Pentaho Kettle requires version 1.0.something of aws-sdk. Our application, on the otherhand needs 1.9.6 of the aws-sdk.
To give more details, the feature of Kettle we require is in the pentaho-big-data-legacy plugin. Even if I upgrade to the latest version of Kettle, pentaho-big-data-legacy still uses the old version of the aws-sdk.
I've read a bit about plugins having special classloaders, so one option I was considering is that maybe I am not downloading the right dependency. However, when I tried downloading pentaho-big-data-plugin instead of pentaho-big-data-legacy, I got weird errors, so I stopped going down this path.
I was wondering if there is any way I could put the Kettle Libs in one folder, and my application libs in another folder, and then set some sort of a PENTAHO environment variable to pick up the libraries from the alternative folder.
Another option is if I could somehow set the pentaho classloader, but I don't know if this is possible.
What are my options for having 2 versions of the aws-sdk in my application, with regards to Kettle?
Maven can do much more than download dependencies.
The Maven Shade plugin can help with your current predicament. During a build, it can rename packages.
You would make a project that builds a "fat jar" (or "uber jar") with Pentaho Kettle and its version of the aws-sdk re-packaged as appropriate. That dependency would be handled before your project is built, so you are free to use whatever version of aws-sdk you like since there is no longer a conflict on package names.
I would like to use jax-ws in a java-5 environment. jaxws-rt 2.2.5 promises to allow access to jax-ws services. However, according to maven repository this artifact relies on about 12 other artifacts. There are constraints in my enterprise that make it difficult to add an artifact to our enterprise repo, and adding a dozen artifacts is much more difficult that adding just one. Because of this issue, I would like to know if there is a larger artifact that I can use to write a jax-ws web service client without the need for any additional dependencies.
Is there a bundled jax-ws jar I can use that has 0 external dependencies?
There is one hacky way to do this.
Download and add the 12 dependencies to your local repo.
Create a Maven project that depends on the 12 dependencies, and use the Maven "shade" plugin to construct an "Uber Jar" that combines the 12 JARs into one JAR. You might include a README file in the JAR to explain how and why it was constructed.
Build the Uber Jar file.
Submit the Uber Jar file for approval.
Frankly, I think this is a technically inferior approach, but if your corporate bureaucracy makes uploading difficult, do what you need to do.
JAX-WS with Java 5 will require a significant number of libraries. This should be true whether you opt for Metro, CXF, Axis or anything else.
Options I can think of are:
Move to Java 6 if you can - in most cases the jaxws-rt 2.2.1-1 (from the group org.glassfish.metro) may be sufficient
Deploy inside and application server (Jboss, Glassfish, etc...). Everything should already be there
Deploy inside a servlet container (Jetty, Tomcat, etc...) in a war. The dependencies will be isolated to that war (servlet API 2.5 or more).
Anything else will probably lead to the "pollution" of your lib folder/classpath and, likely, your endorsed folder.
In spring and cantral repo i can find e.g. spring-support-2.0.8.jar but what repo should I add to my pom to make my ide automatically download sources? I don't see any repo with spring-support-2.0.8-sources.jar
Unfortunately, not all Spring versions were deployed with sources. In a nutshell, from version 2.5, all Spring JARs come with sources.
If the source is missing, then you'll have to find it elsewhere and either add it manually to your projects or you can install a Maven mirror at your company and deploy the sources there after packaging them in a JAR file.
I suggest to try to upgrade to Spring 2.5. Newer versions of Spring are usually drop in replacements of older ones. Most of the time, the upgrade takes a couple of hours.
spring-support doesn't exist in Spring 2.5 anymore; the classes in there are now in spring-context-support.
You can use the fc: prefix to find the JARs which contain missing classes: http://search.maven.org/#search%7Cga%7C1%7Cfc%3Aorg.springframework.mail
As Looking for spring-hibernate3-2.0.8 sources mentions, the source jars were not consistently published back then. The suggestion from that question is to:
get the sources of the old monolithic spring-2.0.8-sources.jar
Is there a way to easily add all (or most) useful JBoss 5.1.2 provided libraries API-s that are out of Java EE 5 spec?
For example: I know that JBoss provides me a possibility of using Log4J logging but I don't know what to put as a provided artifact to my maven project. I guess it is jboss-logging-something. I want it to provide me a logging API only.
Is there a list of maven artifacts for APIs that JBoss AS 5 provides (besides Java EE 5 spec)?
EDIT
It seems that adding this dependency is quite helpful:
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-ejb3</artifactId>
<version>5.1.0.GA</version>
</dependency>
But it causes maven load pretty whole Jboss AS server code. Any better ideas?
I think a better idea is to use the libraries provided by the JBOSS server you deploy on and not have those in your package. Link to the necessary libraries for compiling and running, but don't add them to your spec.
JBOSS has libraries in its /lib, deploy/lib, and the endorsed/lib folders.
The following quote is from the Installation Guide
For a full list of the JBoss and thirdparty libraries used with JBoss AS 5.0.0.GA check the pom.xml found in the component-matrix directory of the source code distribution. To see the maven dependency tree you can run 'mvn dependency:tree' from the thirdparty directory of the source code distro.
You can download the source from here:
http://sourceforge.net/projects/jboss/files/JBoss/JBoss-5.1.0.GA/
and then checkout the pom as described above. Be warned it is a long list, but should provide you with the information that you are looking for.
I've downloaded Spring 3.0.2 with dependencies and found that it contains 405 jar files. I usually keep third party libraries in a "lib" subdirectory, but there are so many Spring jars that it seems sensible to keep them separately so that they don't swamp the other libraries and to simplify version upgrades.
I suspect that I want to keep the full set of libraries in Subversion, but only deploy the subset that is actually used.
Do Spring users have a standard way to deal with this problem?
The vast majority of the "dependencies" are unnecessary, it really is a "kitchen sink" distribution. I would suggest just putting the Spring JARs themselves into lib, and only add the others as and when you need them.
In fact, you can pick and choose which Spring JARS you need - it's split up into several, so that you can pick the appropriate ones. There should be a readme file in the distribution describing which JARs you need, and what they depend on.
If you insist on using Ant, you can use its companion, Ivy, for dependency management. Personally, I have been a fairly happy Maven user for years.
If you build using Maven, you can specify that you require particular Spring libraries. Maven will download these and their declared dependencies into your local repository, and package those jars required into your final solution. You don't need to declare anything other than your top-level dependency on Spring.