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

Add additional POM attributes #3

Open
pombredanne opened this issue Dec 12, 2016 · 6 comments
Open

Add additional POM attributes #3

pombredanne opened this issue Dec 12, 2016 · 6 comments

Comments

@pombredanne
Copy link
Contributor

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?

@wfscheper
Copy link
Contributor

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.

@pombredanne
Copy link
Contributor Author

@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?

@wfscheper
Copy link
Contributor

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

@pombredanne
Copy link
Contributor Author

@wfscheper yes exactly. Do you have that load() function on hand by chance? or it is just a design idea for now?

@wfscheper
Copy link
Contributor

wfscheper commented Mar 10, 2017 via email

@pombredanne
Copy link
Contributor Author

@linexb worked out something that I am reviewing now in aboutcode-org/scancode-toolkit#561
Eventually I would extract this part and send a PR alright here.

pombredanne added a commit to aboutcode-org/pymaven that referenced this issue Jun 9, 2017
 * 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>
@pombredanne pombredanne changed the title Adding additional POM properties? Add additional POM attributes Jun 11, 2017
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