Giter Club home page Giter Club logo

nexus-m2-uploader's Introduction

nexus-m2-uploader.

Requires Python3.10

The idea of this repo is to allow the user to upload the files from a local .m2 folder to a nexus repository.

In it's simplest form, you can upload the full contents of a local .m2 repository

python3 nexus-upload.py .m2/repository --repo-id maven-local --auth admin:$ADMIN_PASS --repo-url https://nexus.example.com

Changes have been made to handle 2 unusual scenarios.

  1. A jar dependency exists without a corresponding pom dependency. These will now be uploaded.
  2. A jar dependency exists with an arch classifier, example shown below.
netty-resolver-dns-native-macos-4.1.82.Final-osx-x86_64.jar
netty-resolver-dns-native-macos-4.1.82.Final.pom

Note: if both scenarios occur for the sample dependency, there will likely be issues because the code uses the POM filename to identify the classifier.


Separating dependecies locally

An additional option to split dependencies is to use the nexus-repository-conversion-tool

The included pom.xml file contains a single dependency which can be downloaded using mvn install This jar can help by splitting local dependencies into separate releases and snapshots folders

Copy the jar to a work folder, from ~/.m2/repository/org/sonatype/nexus/tools/nexus-repository-conversion-tool/2.2.1 and then run

java -jar nexus-repository-conversion-tool-2.2.1-cli.jar -r ~/.m2 -o temp which will produce the following directory structure.

└── temp
    ├── .m2-releases
    └── .m2-snapshots

If you want a clean m2 folder that is limited to just the dependencies of a specific project, you can build the project using the following command, including the -Dmaven.repo.local path

mvn clean install -Dmaven.repo.local=./m2-local

The main nexus-upload.py script was derived from https://gist.github.com/omnisis/9ecae6baf161d19206a5420bddffe1fc and updated for Python3 and Nexus 3.

nexus-m2-uploader's People

Contributors

pksheldon4 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.