15

At my work all development uses Java technology, and we use Nexus to manage our Maven repositories. But for a new project, the build requires dll and exe artifacts. Is it possible to put those windows binary files into a Nexus repository? Is there some plugin to make this simpler? Is what I'm trying to do crazy?

kuporific
  • 10,053
  • 3
  • 42
  • 46
PRF
  • 821
  • 1
  • 9
  • 16

1 Answers1

15

I use Nexus to store all the binary dependencies that I download from the internet.

You can upload the files using the Nexus GUI or use the Maven command line as follows:

mvn deploy:deploy-file \
    -Durl=$REPO_URL \
    -DrepositoryId=$REPO_ID \
    -DgroupId=org.apache.maven \
    -DartifactId=maven \
    -Dversion=2.2.1  \
    -Dpackaging=zip \
    -Dfile=maven.zip

This will generate the POM for your zip package automatically.

To retrieve dependencies, you can just navigate to the Nexus URL, or use a generic dependency manager tool like ivy:

java -jar ivy.jar -dependency org.apache.maven maven 2.2.1 -retrieve [artifact].[ext]
kuporific
  • 10,053
  • 3
  • 42
  • 46
Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
  • I have a file with out `.zip` or `.tar.gz` extension. Now, I want to publish file as is to nexus. Is there any option to publish without extension to nexus? I tried publishing with below options `-Dpackaging=""` and without `-Dpackaging`. Observed below error: ``` 00:01:28.828 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on project standalone-pom: The artifact information is incomplete or not valid: 00:01:28.828 [ERROR] [0] 'packaging' is missing. ``` – rameshthoomu Jul 18 '17 at 18:31
  • 1
    @RBT Packaging is an important piece of metadata to be included when publishing your artefact. Appears the error message is indicating that this metadata is mandatory for your repository. Is there a reason why you don't want to include the packaging? It's unlikely the package repository will convert file formats. – Mark O'Connor Jul 24 '17 at 10:22
  • 3
    @MarkO'Connor I have the same question as @rameshthoomu - we want to publish our binaries built using TeamCity to a Maven repository on Nexus where our production deployment tool will be able to obtain them. Since they are ELF binaries, and don't have an extension, what would the `packaging` type be? – Steve Lorimer Nov 13 '20 at 10:05
  • @SteveLorimer I would say the packaging is binary and the packaging type should be `bin`. A few seconds I installed a PDF file with the packaging set to `pdf`, so it looks like maven accepts arbitrary packaging types. – ahoffer Oct 28 '21 at 18:59
  • I was getting an error "...there is no POM in this directory", I needed to quote the parameters see https://stackoverflow.com/a/16349133/97745 – crowne Apr 14 '22 at 09:31