I've created a project (springboot service).
I need to generate:
the main executable jar, already managed by spring-boot-maven-plugin
also, I need to generate a non-executable jar from some included classes (everything inside me.jeusdi.serializers package.
Any ideas?
Create a multi-module project which has two modules:
the executable JAR
The non-executable JAR
Related
If I add a JAR file to a gradle project's depenencies, the code compiles just fine, but after publishing to maven (publishToMavenLocal), the classes from the JAR are not found.
Obviously, this is because the jar is added as a "dependency" and not part of the project itself. Is there a way to get the contents of the JAR file to merge into the library? Do I need to make a separate maven repo for each JAR?
You can always try to create a fat jar which includes dependencies. You can follow the instructions provided here https://www.baeldung.com/gradle-fat-jar
I have two maven projects. One is a library and the other one is an example utilizing this library.
Because my customer is a little old-school he would like to run the example without using maven and requires that the example contains a folder "lib" containing a fat jar file with the lib.
Using maven-assembly-plugin I have been successful in repackaging my lib. as a fat jar but only if it is declared within the lib.'s pom file. But from my POV I would like to have this declaration in the pom file of the example and not the lib. (in order to avoid polluting my lib. with this nonsense).
So my question is: Is it possible to build a fat jar file for a dependency in a maven project? That is, can I use a plugin like maven-assembly-plugin to repackage my lib. as a fat jar from the pom of my example project?
I have a maven project currently structured that has to build a jar first from some source files, then create an ear file containing that jar along with some other xml resources. The way I do it at the moment is by building the jar seperate in a 'child' pom.xml then at the root of the project folder I have a parent pom that does the ear packaging.
I know it isn't ideal, but I what to be able to compile the jar and then package it into an ear all with just one pom.xml file. Any ideas on how to do this?
How to write a gradle script so that the application jar should be packed without dependency classes similar to maven jar package
The application JAR is always without dependencies, except you use special plugins to create a "fat" JAR where the dependencies are included. If you ask how to set up a Gradle build at all, you should start reading the Users Guide.
If you are trying to package a jar from your Android app or library:
I ran into this question because gradle would include 3rd party libraries into my jar when running gradle assembleRelease.
The contents of the jar then looked like this:
com/android/...
/myCompany/...
For some reason this did not happen when building for debug. Finally I found that changing:
compile 'com.android.support:recyclerview-v7:23.0.0'
to
provided 'com.android.support:recyclerview-v7:23.0.0'
would not include the 3rd party libs ...
I have a project build on gradle and it has a directory src/main/dist/deploy. In deploy folder there is a xml file. This xml file i want to add as a dependency in the jar file which my build.gradle is generating. This jar i am adding in the lib folder of another project that has a dependency on my gradle project. The other project is built using ant. When classes bundled in gradle jar are loaded from ant project they are unable to read that xml file from the gradle jar.
The standard java plugin does not look in src/main/dist/deploy for resources.
You should either move the xml file into java plugin's standard resource folder src/main/resources, or add the dist/deploy folder to your main sourceSet's resource list.