Naming artifacts something other than the maven "standard"

1,598 views
Skip to first unread message

Patrick Struhs

unread,
Mar 31, 2015, 2:14:22 PM3/31/15
to nexus...@glists.sonatype.com
I've have been running into new use cases for Nexus, which seem to go against the standard naming convention Maven uses. The reason I am running into this issue is we have artifacts that have been delivered or downloaded from websites ( like oracle client installs for example ) which we would like to store in a repository.  We de decided to use Nexus, but have had issues largely due to naming of the files.  For example I might download a file like Foo_client_v15.3.2.1.zip. At first glance I would store the file in Nexus with GAV defined as follows:

GroupId= com.vendor
ArtifactId= Foo_client
Version=15.3.2.1

Now when it is stored in Nexus the file becomes
Foo_client-15.3.2.1.zip

It's fairly obvious by looking at the file that this would match the original file
Foo_client_v15.3.2.1

but I would rather not have any renaming at all,  and would like to provide a URL directly to the Nexus file so users can download the file from Nexus without changing the name.

I would also like the maven dependency plugin to be able to download the file with it's original name without a lot of configuration or manipulation in the pom file.  I tried uploading files, using a pom file, which had finalName defined as the original file name, but at least using the maven dependency plugin I was not able to get these files out of Nexus and having any plugin honor the finalName.
eering team to store the binaries they use to install applciations,  but for third party applications where we do not have control of the original filename, it does not seem like Nexus is a good solution.


Does anyone have any suggestions or similar experiences?

thank you.

Brian Fox

unread,
Mar 31, 2015, 2:25:50 PM3/31/15
to Patrick Struhs, nexus...@glists.sonatype.com
The renaming is happening by Maven and if you want the dependency plugin, or really anything in Maven to access these files, it will have to follow the maven standard. You can put any file into Nexus and pull it back out with the same name.



--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/6597d2fc-a60d-4888-b2a5-77d35aa15b4c%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.

Patrick Struhs

unread,
Mar 31, 2015, 3:59:50 PM3/31/15
to nexus...@glists.sonatype.com, patric...@gmail.com
Brian,

Thank you for the information.  I have used two ways to upload the file, both of which rename the files. I have used the following
1) mvn deploy-file - which I understand from you would rename the file
2) Nexus Gui (Artifact upload tab ) 

Maybe the GUI uses maven on the backend,I'm not sure but it doesn't upload as the same filename.

So are my other options
1) Curl command line
2) uploading directory to the file system and rebuilding metadata?

thanks, Patrick

Brian Fox

unread,
Mar 31, 2015, 4:05:34 PM3/31/15
to Patrick Struhs, nexus...@glists.sonatype.com
On Tue, Mar 31, 2015 at 3:59 PM, Patrick Struhs <patric...@gmail.com> wrote:
Brian,

Thank you for the information.  I have used two ways to upload the file, both of which rename the files. I have used the following
1) mvn deploy-file - which I understand from you would rename the file
2) Nexus Gui (Artifact upload tab ) 

Yes, you are correct this method is for maven2 and will rename the file according to the standard.

You could do a curl put into the system and the file won't be renamed.

I would really encourage you for future sanity though to stick with the maven standard. Going against the grain unless you intend to forgo any Maven integration (or with tools that understand maven standards) is a bad idea.
 

David Hladky

unread,
Apr 1, 2015, 4:12:08 AM4/1/15
to Patrick Struhs, nexus...@glists.sonatype.com
Hi,

you can copy your artifact "behind Nexus back" directly to the repository directory in the file system and then update and repair indexes. The file would be accessible normally. Maven would probably not be able to use it, but people would be able to download the file from Nexus.

It is better to use the correct naming conventions, but in case you do not have this option (third party file), you can do it that way.

David Hladky
>>> <https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/6597d2fc-a60d-4888-b2a5-77d35aa15b4c%40glists.sonatype.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/a/
>>> glists.sonatype.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Nexus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nexus-users...@glists.sonatype.com.
> To post to this group, send email to nexus...@glists.sonatype.com.
> To view this discussion on the web visit
> https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/0635b2b6-c387-4f66-bfd9-25f736af2e50%40glists.sonatype.com
> <https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/0635b2b6-c387-4f66-bfd9-25f736af2e50%40glists.sonatype.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit
> https://groups.google.com/a/glists.sonatype.com/d/optout.
>

--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/CAOhT-pNvQHtoQGdcef70%2BX7yt6KPijT3gHv10Rbn5s_mwLqvhA%40mail.gmail.com.

Manfred Moser

unread,
Apr 1, 2015, 11:29:42 AM4/1/15
to patric...@gmail.com, dhl...@redhat.com, nexus...@glists.sonatype.com

I would strongly suggest AGAINST doing this. The repository will essentially contain artifacts that are NOT reachable by Maven or any other dependency resolution system for a Maven repositor implemented in other build systems.

This essentially means that you are treating a Maven repository like a file storage with random file naming and are throwing away any opportunity to use the files from a build system. 

Only a hand crafted download to the specific file using a curl, wget or something similar will be able to download the artifact. In turn you are invalidating the Maven repository since it will contain folders that are (from the Maven formats point of view) essentially empty.

I would suggest to instead stick to the Maven format and either refactor your build system setup to rename the referenced file or implement a renaming there.

If you REALLY have to use a specific structure... don't use a Maven repository format. Instead use a site repository and do whatever you like (its essentially free form).

manfred 

Reply all
Reply to author
Forward
0 new messages