Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version regexp match fails on artifacts with numbers #40

Open
alkuzad opened this issue Feb 27, 2018 · 6 comments
Open

Version regexp match fails on artifacts with numbers #40

alkuzad opened this issue Feb 27, 2018 · 6 comments

Comments

@alkuzad
Copy link

alkuzad commented Feb 27, 2018

It's rare but can happen, for example:

https://mvnrepository.com/artifact/org.neo4j/neo4j-cypher-compiler-2.1/2.1.2

Has jar named neo4j-cypher-compiler-2.1-2.1.2.jar.

I wanted to made PR for that but I couldn't find any naming convention that could specify what is correct jar naming. So I made subclass LocalArtifactWithPomDetection which loads this data from pom file, if exists (almost every time, there is one)

@stardust85
Copy link
Member

Bravo. Loading from pom file makes sense. Feel free to create a PR and we'll review it and eventually merge it. Don't forget to implement a unit test as this is testable easily

@alkuzad
Copy link
Author

alkuzad commented Mar 1, 2018

@stardust85 thanks for response :) I will try to make my solution more general and make PR with new artifact class.

Btw. thanks for this lib. Nexus REST api docs are so messed up, I would spend weeks figuring all of this. I failed on using requests to send POM + Jar in same request and I had to fallback to pycurl - because of not implemented 100-Continue in requests.

@stardust85
Copy link
Member

Thanks for letting us know you like it and what is your use case :). I created it to make it easier to upload RPM packages to nexus, but it is generally usable of course :) Btw, when I worked on a Java project, I used gradle to upload to nexus. It also works well. And of course supports both jar and pom files.

@alkuzad
Copy link
Author

alkuzad commented Mar 1, 2018

@stardust85 unfortunately this case is not simple CI style - mvn clean verify + mvn deploy :D I am from SCM department and we usually work only on finished product - in this case jars already made, without compile environment. I think we could do some generation to leverage maven but it was easier for me to control every part of deployement from code.

@mheyman
Copy link

mheyman commented Feb 12, 2021

This regex seems more robust:

^(?# name)(.*?)(?:-|_|\.)(?=\d)(?# version)((?:(?:\d+)\.)*\d+(?:-(?:[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?)\.(?# extension)([^.]+)$

I plugged in a semantic-versioning-aware regex in the middle.

@alkuzad
Copy link
Author

alkuzad commented May 19, 2021

just realized that work is on branch not touched for a while, maybe someone will use it :D https://github.com/alkuzad/repositorytools/tree/pom-artifact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants