-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add additional POM attributes #3
Comments
That would be great. When this project was started, dependency information was what we really needed so that was the focus, but always interested in enhancing the feature set to make pymaven a more fully featured maven client. |
@wfscheper there is no way to create some pom object straight from a .pom file, right? e.g. you need to know the coordinates and the main purpose here is to talk to a remote repo in the context of known coordinates? |
Yes, that's the way the current API works. Sounds like you want something more like an object model of a pom file. The original need was for a way to construct the full set of dependencies for any given project, thus the starting point was a set of maven coordinates and a maven client that could talk to a repository like maven central. Extracting a simpler object that doesn't provide dynamic dependency discovery should be possible. Something like given a pom file <project>
<parent>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-module</artifactId>
<version>1</version>
</project> You could do: >>> from pymaven import pom
>>> with open('some_pom.pom') as fh:
>>> p = pom.load(fh)
>>> p
Pom('com.mycompany.app:my-module:1')
>>> p.artifact_id
'my-module'
>>> p.group_id
'com.mycomany.app'
>>> p.version
'1'
>>> p.model_version
'4.0.0'
>>> p.parent
Pom('com.mycompany.app:my-app:1')
>>> p.parent.parent |
@wfscheper yes exactly. Do you have that load() function on hand by chance? or it is just a design idea for now? |
On Fri, Mar 10, 2017 at 8:35 AM Philippe Ombredanne < ***@***.***> wrote:
@wfscheper <https://github.com/wfscheper> yes exactly. Do you have that
load() function on hand by chance? or it is just a design idea for now?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAD5s7Kdoqq6cLvHXxqkHNlaYwAAHiB1ks5rkVG0gaJpZM4LKsJ3>
.
Just a proposal for now.
I took a stab at an implementation, and it wasn't hard to get something
that seems to work. Will need some more testing, but I will try and put a
branch up on my personal fork that you can try out.
--
Sent from my phone
|
@linexb worked out something that I am reviewing now in aboutcode-org/scancode-toolkit#561 |
* this allow subclasses working without clients to override the _get_pom_factory method and return plain artifacts from coordinates rather than full Pom objects when there is no client to retrieve an artifact remotely. Link: sassoftware#3 Link: sassoftware#4 Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Hi: I have some code that predates pymaven here https://github.com/nexB/scancode-toolkit/blob/develop/src/packagedcode/maven.py and does a barely OK job for getting some POM attributes (including legacy POm versions) but does nothing about deps. In contrast pymaven handles deps mostly.
If I go the pymaven route instead of my "legacy" code, would you be interested in getting extra attributes handled by pymaven such as url,s licenze, descriptions, scm, etc if I were to contribute this?
The text was updated successfully, but these errors were encountered: