Why after compiling/building my AWS sdk jar is only 3kb? - maven

I was previously on 1.6.x and mvn clean install builds wit no issues; end up with a 10mb jar and able to run all my code.
Now I want to upgrade to 1.10.x for the new lambda/apig/ddb support, I changed the version from 1.6.x to 1.10.x.
But after I build with mvn clean install, I see the jar is only 3kb, why is that? Has something changed with the way the AWS sdk works? At least from I've seen, one new way is you can be pick specific services rather than the whole sdk.
Edit:
The 3kb jar has the following:
pom.properties:
version=1.10.66
groupId=com.amazonaws
artifactId=aws-java-sdk
pom.xml, which lists all the aws sdk services

Have you uncompresssed the jar file and looked up what is in that folder? Based on the information in your question, I guess you have just got your own source files there but not the dependencies. If any, maven dependencies are usually located at META-INF\maven in jar. BTW, do you use maven plugins? For example, maven-jar-plugin only outputs your source code in jar while maven-assembly-plugin also outputs maven dependencies.

Related

How can I include the jboss-client.jar present in the Wildfly bin/client folder to my maven project?

I have a maven project to which I have to add a external jar jboss-client.jar which is located in Jboss Wildfly 10 bin folder(bin/client). There is no version specified in the jar name.
When I add the jar manually in build path-it works fine.
However, since this is a maven project, I require a better way of doing this.
Note: The project works with only this jar and not other versions specified in pom.xml which I tried downloading.
Also, if I try to specify the external dependency in pom.xml, it asks for version of the dependency. However, I cannot specify the same as it is not mentioned in the jar.
My ultimate aim is to deploy this project in Jboss Wildfly 10.
Is there any other alternate way, I can add the jar?
Copy your jar to some other location and unzip/decompress it, then find Manifest file located at META-INF\MANIFEST.MF path.
Open it in text editor and look for Implementation-Version.
It will give you the version.
Reference
You can use maven to install third party library in local.
https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
Using below command you can install.
mvn install:install-file -Dfile=path-to-file/jboss-client.jar -DgroupId=org.jboss -DartifactId=jboss-client -Dversion=1.0

How to build a standalone AWS SDK .jar that includes all the dependencies

We are trying to build a standalone .jar (.zip file) that includes all the dependencies based on aws-sdk-java-1.11.86 using maven command line.
The pom file for AWS is quite complex and we are concern changing it or writing or own since it might not be compatible with newer version of AWS.
Does somebody knows how to do it?
The command is:
mvn package
The actual maven target is "aws-java-sdk-bundle".

How to stop maven deploying test jar files

Maven has a useful facility to create jar files for tests that can be depended on by other projects. We use the "easy way" from this page. This all works fine, and produces files of the name foo-1.0.0-tests.jar.
By default, these test jar files are installed and deployed. The question is how to have them be installed, but NOT deployed?
(There is no need or desire to publish these files to maven central, but they are needed when running tests locally. Thus install is correct, and deploy is not.)
The maven deploy plugin appears to have has no suitable options. The build-helper-plugin has the ability to attach file to deploy, but not to remove them.
Any suggestions to get these jar files installed, but not deployed?

How to download maven dependencies from Jenkins without a binary repository

Are there any plugins or ways to download the dependencies for a maven project from Jenkins? I am using Jenkins for a multi-module desktop application. Although I know I could just archive all dependencies, I don't see why there isn't the ability to download dependencies using maven which installed on the same machine as Jenkins. Preferably one would specify the location of a pom and then have the ability with one click to download all the dependencies for that pom. Can you do this? I do not need or want an entire binary repository for this feature.
Edit: I will try and rephrase this as I don't think people are understanding.
In Jenkins one has the ability to archive artifacts at the end of a build. Also in jenkins you have integration with maven. When building a jar in maven you have arguablly 2 options:
You can either use the assembly plugin which zips all .class files
together with those produced from your source code resulting in 1 jar
You can create a jar just source code which references all
dependency jars which are located in a separate folder.
In Jenkins one also has the ability to download the latest artifact. Now if I am using Option 2, I can either archieve just the jar which my sources produced, which I would say is more desirable for space and is the whole purpose of the archive functionality, or you can also archive the libraries too.
Here is the PROBLEM!! If I don't archive the libraries then I cannot easily run this jar, as it is a desktop application and its dependencies cannot be obtained in the same mannor as clicking on a link from jenkins. So lets say my question is what is the easiest way to obtain them? Extra info: assume jenkins is running as a server and you can't use artifactory or another server application, that seems to me to be massive over kill.
Use the maven plugin and create a maven job for your project. Jenkins will then use the maven command you provide in the job configuration to build the project. This means maven will download the projects dependencies and store them on the machine jenkins is running. Normally this would be <JENKINS_HOME>/.m2/repository. This way you get a local repository that only contains the dependencies of the projects you created maven jobs for.

IntelliJ: Including jars in a jar artifact

Developing on the Mac with IntelliJ 9.0.2 Community Edition.
I have a program which depends on two library jars. I have figured out how to get IntelliJ to make me a jar of my source (with the Artifact tab), and even to include the two jars in it.
However, if I get a listing of the jar file it produces, it looks like this:
com/acme/MyClass1.class
com/acme/MyClass2.class
...
mylib1.jar
myLib2.jar
And, no surprises, if I double-click the jar file, it gets a NoClassDefFoundError the first time it tries to access a class in one or other library jar.
It seems I need to tell IntelliJ to "inline" the library jars -- but this menu option is always greyed out!
Does anyone have any idea how to get jars inlined in a jar artifact?
IDEA doesn't support it yet, you can use Ant integration to package your jar (either by unpacking all the jars into the temp folder and then packaging the project output plus this temp folder into the single jar or by using some Ant task like jarjar).
If you want this feature to appear in the future IDEA versions, please vote for the request.
Having the dependency JARs included in your JAR should allow yoru code to run successfully. You probably don't have the JARs on your classpath.
I will use Maven Assembly plugin. Its simple and will give you a neat little jar file..

Resources