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

wrong artifactId in generated pom.xml #29

Open
domdorn opened this issue Mar 4, 2021 · 9 comments
Open

wrong artifactId in generated pom.xml #29

domdorn opened this issue Mar 4, 2021 · 9 comments
Assignees

Comments

@domdorn
Copy link

domdorn commented Mar 4, 2021

Hi!
In my project, we're migrating from using maven-central directly to proxy it through artifactory. When artifactory is fetching the pom.xml of sbt-spotless, it fails as the artifact-name apparently is wrong..

the request is as follows:
https://artifactory.acme.com/artifactory/maven-viopt/net/moznion/sbt/sbt-spotless_2.12_1.0/0.1.3/sbt-spotless-0.1.3.pom
which proxies through to
https://repo1.maven.org/maven2/net/moznion/sbt/sbt-spotless_2.12_1.0/0.1.3/sbt-spotless-0.1.3.pom

it gives this message:

{
  "errors" : [ {
    "status" : 404,
    "message" : "Failed to transform pom file: The target deployment path 'net/moznion/sbt/sbt-spotless_2.12_1.0/0.1.3/sbt-spotless-0.1.3.pom' does not match the POM's expected path prefix 'net/moznion/sbt/sbt-spotless/0.1.3'. Please verify your POM content for correctness and make sure the source path is a valid Maven repository root path."
  } ]
}

from looking at the sbt-spotless-0.1.3.pom file, the current artifactId

<artifactId>sbt-spotless</artifactId>

would need to be changed to

<artifactId>sbt-spotless_2.12_1.0</artifactId>
@domdorn
Copy link
Author

domdorn commented Apr 20, 2021

If anyone else comes across this issue:
We've uploaded this file (without the .txt extension) to our artifactory and then resolving the files worked.
sbt-spotless-0.1.3.pom.txt

This is how its configured:
grafik

@moznion
Copy link
Owner

moznion commented Apr 25, 2021

I'm sorry for my late response. I'll take a look at this.

@moznion moznion self-assigned this Apr 25, 2021
@moznion
Copy link
Owner

moznion commented Apr 25, 2021

https://repo1.maven.org/maven2/net/moznion/sbt/

As you can see in the above link, the artifact identifier has to be sbt-spotless_2.10_0.13 or sbt-spotless_2.12_1.0 because this plugin supports cross Scala and sbt versions.
In fact, if you includes this sbt-plugin in plugins.sbt (or other simlier file) by describing like addSbtPlugin("net.moznion.sbt" % "sbt-spotless" % "0.1.3"), the sbt automatically choose the correct artifact ID according to the runtime.
First of all, this is an sbt-plugin so I deem there is no use-case to include this by describing into pom.xml or other dependency management files directly. Do you mean this problem occurs even if you include this in plugins.sbt and proxy it, @domdorn?

@moznion
Copy link
Owner

moznion commented Apr 25, 2021

FYI, I've checked sbt/sbt-release this is a major sbt official plugin: https://repo1.maven.org/maven2/com/github/sbt/sbt-release_2.12_1.0/1.0.15/sbt-release-1.0.15.pom

This seems the artifactId is sbt-release, not sbt-release_2.12_1.0. So I suppose this is not a strange situation in an sbt-plugin manner.

@domdorn
Copy link
Author

domdorn commented Apr 25, 2021

Hi,
I've included the plugin like it is written in the documentation in my project/plugins.sbt

addSbtPlugin("net.moznion.sbt"         % "sbt-spotless"        % "0.1.3")

Like I've mentioned, the problem is that dependency proxys like JFrog Artifactory (I'm not sure Nexus does this also) check that the artifact-id in the pom file matches the path it is downloaded from / adheres to the standards set by the repository type (here maven). If this does not match, Artifactory simply blocks the download of the pom.xml file which then in turn blocks downloading of the plugin by sbt as a whole.

IMHO also the sbt-release plugin does this wrong, the artifactId in the pom should be sbt-release_2.12_1.0 (like its encoded in the path) - I've created sbt/sbt-release#290 for this .

E.g. if you look at the dependency of sbt itself,
https://repo1.maven.org/maven2/org/scala-sbt/main_2.12/1.5.0/main_2.12-1.5.0.pom
this has the artifactId (imho correctly) set to main_2.12

@moznion
Copy link
Owner

moznion commented Apr 26, 2021

Thank you for the information.
I understand the current status. Literally, it seems we should correct the artifactId to be suitable with the ${name}_${scalaVersion}_${sbtVersion}, I'll try it.

@moznion
Copy link
Owner

moznion commented Apr 29, 2021

NOTE: sbt/sbt#6479 (comment)

@moznion
Copy link
Owner

moznion commented May 18, 2021

@domdorn Can I close this issue? I guess this is not a problem of only this plugin, this would be an issue across the sbt.

@domdorn
Copy link
Author

domdorn commented May 19, 2021

hmm.. while the problem is not resolved, I guess we can't do much about it for now except to do some processing before the file is uploaded to maven-central. I guess the sbt team will fix this in the upcoming weeks anyway, so for now we could close it.

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

2 participants