How install Swagger without Maven - maven

I am not Maven´s user and i want configure all dependencies of Swagger in my project. I try make it unsucessful. I get thousands jars, jackson-, swagger- and nothing.

From https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-JAX-RS-Project-Setup-1.5.X#adding-the-dependencies-to-your-application:
Projects that cannot utilize maven's dependencies would need to add
the dependencies manually. Since those may change from version to
version, the list of dependencies will not be documented here.
Instead, it is advised that you clone the swagger-core repository, go
to the directory of the relevant module (artifact) and run mvn dependency:list. That would give you a list of dependencies required
by swagger-core which you would have to include manually in your
application. Keep in mind this requires you to have maven installed
but it does not require you to use maven for your project.

Related

How can I make Gradle download optional dependencies automatically?

When downloading dependencies using Gradle it seems to exclude optional dependencies. For example, I included Guava:
compile 'com.google.guava:guava:19.0'
and it did not download the optional dependencies listed here: https://mvnrepository.com/artifact/com.google.guava/guava/19.0
I've been learning Gradle and porting a legacy app to use Gradle. That application had a Python script wrapper that always downloaded the optional dependencies and I've kind of hit a wall here.
According to the description of the Maven's Optional Dependencies:
If a user wants to use functionality related to an optional dependency, they will have to redeclare that optional dependency in their own project.
Gradle has the same behavior as Maven, if you want to use some transitive optional dependencies - you have to declare them manually.
You can try to find some workaround, but anyway, it seems to be a little odd, to include all optional dependencies by default, don't even check, whether are they really needed. Sure, you can try to port your logic to run existent Python script with Gradle to collect all optional dependencies into local directory and declare it as file dependencies.

Fetch all dependencies, put them in a new local Maven repository using Gradle

I have a Gradle project with several subprojects and many, many dependencies. I would like to have a simple way to tell Gradle to download all dependencies (including those under buildscript!) and put them in a local Maven/Ivy repository for later use. The Gradle script should then be able to pull all dependencies from the local repository.
Background: I need to build the application on a server which has absolutely no access to any public Maven repositories, so all dependencies must already be present on the host. I've tried a flat directory, but I have not found it easy to resolve the transitive dependencies, and managing them by hand is not an option. Copying the Gradle cache did not work, either.
Can anyone suggest something? Thanks.
I found a solution, namely to install Apache Archive (http://archiva.apache.org/) locally and set it up as a proxy. Then I copied the entire installation to the target-server and disabled the remote repositories. The dependencies could then be fetched locally.

Adding all jars from a Nexus repo to Leiningen dependencies list

I want to add all jars from the local Nexus repo to a Leiningen :dependencies list. I've added the Nexus repo to the :repositories list in project.clj. Is there any way to add all jars to :dependencies, instead of specifying them one by one?
Thanks!
pom to project
"Java project's lib folder contains lots of jars"
Does this Java project fetch these jars directly from nexus repo (e.g. via pom.xml), because it should.
And if it does, and you just don't want to manually craft project.clj with all these dependencies, you can use something like lein-nevam to convert it to project.clj to start you off.
less dependency, more independency
Does the Clojure library really need all these Java project's dependencies though? Or just a subset of them? As I mentioned in comments, it is always best to narrow down the number of dependencies due to many reasons: code collision, transitive dependencies, version management, compatibility, etc.. rather thаn to "just include them all"
In order to use Nexus you just have to configure Leiningen to use Nexus as the repository. Then you can specify all your dependencies as usual but they will be retrieved from Nexus. This can include components from Central, clojars and any other repo you want to add to the public group.
More details are in the Nexus book chapter about tool config and especially the Leiningen section.
If you then specifiy the dependencies you need in your library (and only those) and publish to Nexus with a pom that specifies these any Java project that uses Maven or Gradle or whatever to build can consume your library and will also get the correct transitive dependencies. Same is if your code was e.g., created with Maven and written in Java.

What is the purpose of providing a downloaded pom.xml on mvnrepository.com

On mvnrepositry, when you search for a certain module, there's a link to download the binary. For some versions it has a pom.xml file available for download instead of the jar. What are you supposed to do with that pom.xml? It seems like if I specify a version that does not have a downloadable jar, but instead downloadable pom.xml, my maven build will fail. Is what I'm seeing correct?
Modules that only have pom files are maven modules with pom packaging. They are used to aggregate multiple modules into one unit. You can use such a module as a dependency for your maven project. Maven will download the pom file, analyze the dependencies included in that pom file and download those & add it to your automatically.
Even modules that have jars (jar packaging) have a pom file associated with them. This pom file defines the other dependencies that are required for using it. Maven will automatically process and fetch those dependencies (transitive dependencies).
This makes specifying and managing dependency for any project. You will specify the top level modules that your projects directly depends on and other things required will automatically figured out and downloaded. It also makes it easier when you have upgrade to a new version - all the transitive dependencies will get upgraded automatically.
One of the reason that cause this is because of licensing issue.
License for such JARs prohibit public redistribution in such approach. So someone provide only the POM so that you can get the JAR yourself and install it to your local maven repo/ internal repo, together with the POM provided.

Maven repository archive including build/plugin dependencies

My Client wants to be able to build our project from source but does not want to connect to the internet to get any dependencies for the build. Note this will include plugin dependencies.
My proposal is that we provide the client with an archive containing all the dependencies in the correct Maven repo file structure, including checksums and meta information. They can then use this as an internal maven repo.
I have configured the maven-assembly-plugin to create such an archive, however it doesn't include all the build/plugin dependencies that their Maven will require to perform the build.
Does anyone know of a way to include build time dependencies in the archive, or can suggest another way to grab these dependencies and wrap them up in the correct structure.
Many thanks,
Pat
On a clean repository, you can run mvn dependency:go-offline. This will download all the plugins and dependencies relevant to the project. You can verify that this is good by doing an offline build (mvn -o clean install).
Once this works fine, you can create an archive of the repository and the sources and pass it on.
Have you taken a look into the maven-dependency-plugin and furthermore i would suggest to do a complete compile and package and after that you can package the local repository from that user ($HOME/.m2/repository). Than you have everything which is needed to do a full compile etc.
Try mvn dependency:copy-dependencies. This will copy all the dependencies to a directory target\dependency.
However, I'm not certain whether this includes the dependencies necessary to build, as well and those necessary to install the compiled output.

Resources