How to get Spring dependencies for Spring Framework?

Hey, an update to this:

So I’ve now learned it’s better to use a configured (local) repository rather than using whatever the user happens to have cached in their maven local repo (~/.m2 on Mac), for several reasons:

  • Easier to use in build / CD stuff (like a Maven box in GH actions)
  • Easy to swap out for a remote repo eventually
  • Can be version-controlled (could be a con, but fine in this case since it’s just one artifact…)

All I had to do was:

  1. Create a folder in my project to act as the repo (included in source-control)
  2. Update my POM with the repository
  3. Install into the local repo

In my case, my project directory is:

my-project
    |-- local-lib
    |-- src
    |-- pom.xml

And I added this to my repositories:

<repositories>

    <repository>
         <id>my-local-lib</id>
         <url>file://${project.basedir}/local-lib</url>
     </repository>

</repositories>

And then could install it locally by copying the jar to my directory, installing the jar, and then deleting it:

mv ~/Downloads/versioning-1.15.3-obf.jar .      # Move the jar to the project directory
atlas-mvn org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file \
-DgroupId=com.deniz.jira \
-DartifactId=versioning \
-Dversion=1.15.3 \
-Dpackaging=jar \
-Dfile=versioning-1.15.3-obf.jar \
-DlocalRepositoryPath=lib
rm versioning-1.15.3-obf.jar                    # Remove the jar from the project directory

After installation, the directory looks like this:

my-project
    |-- local-lib
        |-- com
            |-- deniz
                |-- jira
                    |-- versioning
                        |-- 1.15.3
                            |-- versioning-1.15.3.jar
                            |-- versioning-1.15.3.pom
                        |-- maven-metadata-local.xml
    |-- src
    |-- pom.xml
2 Likes