Managing multiple versions of a project dependency on Tomcat using Maven - java

I am using Tomcat server and I've got multiple versions of a product that is built on Maven, they are using almost same library.
How can I centralize the library of all versions in one place, when I do
not want to place that library in the Tomcat 'lib' folder?

Maven itself has a concept of centralized repository. Use can specify the location of centralized repository in settings.xml file of maven.

Related

How to provide dependency JARs to Jenkins for building Maven project?

I have a Maven project that uses two dependency JARs which I built in my local environment. But, when I am trying to build the Maven project (clean install), it is failing since it is unable to find those two JARs. How do I pass those two JARs?
The project is pulled from Git and then built. It is working fine unless there are dependency JARs.
The common practice today is to upload it to some artifact storage (Nexus, Artifactory, Azure Devops Feed and so on).
If you have no one, you can install those jars to your local repository (on jenkins slave or master. You must copy your jars before.) using Maven Install Plugin .
In Maven, you draw your dependencies from a Maven repository. Many jars can be drawn from MavenCentral. In a company environment, you usually run your own Nexus/Artifactory, in which you manage your artifacts (that you built) and the external dependencies. This is the best place for your JARs.

To add External Spring jars for a spring project without Maven

I just downloaded the Spring IDE and Tool suite from Eclipse Market place.I am creating a sample Spring project using Spring core containers. I am following a tutorial video for that. I want to set build path by adding external downloaded Spring jars for that I have gone to build path of a specific project and I don't know where my downloaded external spring jars. I have searched in my local drive in java folder in programming files and also where my eclipse is saved. But I cannot find where my external spring jar files saved.
Kindly tell me the path where I can find external downloaded jars from eclipse Marketplace
Spring Suite tool is Rapid Application Development plugin, which helps to decrease spring configuration time and help you focus on core logic of your application.
Even though, As Martin Lippert Explain below, you might have to use Maven (Build Automation tool, And project dependency manager) for creating spring project.
people often use Maven for their dependency management (or Ivy or something else) and would like to use a specific version of the Spring framework (instead of the libs that are inside STS and used by STS itself). But you can define a user-defined Library that contains all the necessary Spring framework JARs and maybe others and just add that user-defined library to each project. Would make it a bit easier as adding several JARs all over again.
Maven uses a filesystem tree as a repository to store jar files with there metadata(dependency, version, etc.) which is located (by default) under your home or My Document Path within .m2 directory (folder).

How to deploy an Eclipse project referencing a sub-project on Heroku?

I'm working on a Java web project using Heroku as hosting PaaS. As IDE I'm using Eclipse and I'm trying to deploy this project.
In a previous version the project had only Maven dependencies, but now I'm referencing another project as dependency of the main web-app that doesn't reside in the main repository.
Which is the right approach to this case? Should I use a single repository?
The "right" way to do it is making the project you depend on a published artifact in a Maven repository. But that is a pain for small projects.
Here are some other options:
Build the app locally from your /.m2/repository artifacts and deploy with Heroku Maven plugin
Check the JAR file dependency in to Git as an unmanaged dependency
Make the dependency a Maven module in your main project, but also make the module dir a Git submodule. That way it's still a separate project but can be deploy to Heroku as a single app.
If you decide to do it the "right" way, I recommend deploying the artifact to bintray.com, which is a little easier to use in this kind of scenario than, say, Sonatype.

Dependency management on tomcat server

I have a java web application which is deployed on several servers. The project uses maven dependency management tool.
The war file that is created after including all the dependencies is quite large. If I use scope "provided" for all dependencies, the war fail created is quite small. I want to use the latter war file for deployment and manage dependencies on the remote servers itself.
I can add a folder containing those dependencies to all the servers and include it in the tomcat class path but if in future I add another dependency I will have to add that dependency to all the servers. Please suggest a workaround.

Shared libraries in glassfish using maven

I need to setup a shared library in a glassfish server using maven to avoid a huge generated ear when I need to deploy my application.
How can I do that?
You can simply use the maven-assembly-plugin to create an archive of the dependencies you need to create the shared-library artifacts together.

Categories