Fork me on GitHub
#depstar
<
2021-03-13
>
dcj00:03:36

I have a “philosophical” question/proposal regarding depstar and pom.xml files: If we can generate a pom file automatically from information contained within deps.edn and the SCM/VCS environment of a project, then we should, and if so, then there is no need for a project to maintain a pom.xml One retort I received was along the lines of “maven and pom have way too many features, and why should Clojure tool devs try and deal with all that”, which is a good/reasonable point, but I wonder of this might be a case where we could solve (easily) this for 90% of projects, and for others, maintain the existing mechanism of using depstar to modify the existing pom, to handle the cases where pom/maven features are needed that are not expressible via deps.edn. I am no expert on on maven/pom, so maybe I am way off base here, but it seems like this might be doable with relatively small/moderate changes to existing tools, depstar specifically. ATM, depstar (in combination with clojure -Spom) generates a pom containing:

<packaging>
<groupId>
<artifactId>
<version>
<name>
<dependencies>
<build> with <sourceDirectory>
<repositories>
For “common” cases,what else is needed? Some sections that are missing from autogenerated poms include:
<description>
<url>
<licenses>
<developers>
<scm>
<distributionManagement>
What else is missing/needed? Most of those could be filled in with relatively static data/strings contained in deps.edn. The `<tag>` within <scm> needs information from the current SCM/VCS environment, and depstar does this when generating pom.properties, so leveraging that code seems possible. In the case that a project needed to provide a more extensive pom “template” that would be updated by depstar, then it might be nice if this pom-template.xml could be specified as a starting place for the pom update, and that the resulting pom would have a different file name, eg pom.xml or whatever is specified by :pom-file so the pom-template would likely be checked into the project, but not the generated pom. What do people think? Is this a terrible idea? (would not be the first time for me!) What am I missing? If there was interest/support, I’d be happy to write the code as a PR….

👍 3
seancorfield03:03:56

depstar doesn't need a pom.xml at all (now -- it used to).

seancorfield03:03:12

You as a developer need a pom.xml file to deploy to Maven or Clojars.

seancorfield03:03:00

http://cljdoc.org uses pom.xml (from inside the JAR I believe?) to figure out how to find the GitHub source and docs and which git SHA or tag or whatever to use to generate the docs.

seancorfield03:03:25

clj-new includes a full-fledged pom.xml template that works with Maven/Clojars and http://cljdoc.org.

seancorfield03:03:51

When you depend on an artifact on Maven/Clojars, that dependency needs the pom.xml flie. When you depend on a local or git dep, tools.deps.alpha needs either deps.edn or pom.xml.

seancorfield03:03:43

@dcj I've no idea what you think needs to be depstar regarding pom.xml?

seancorfield03:03:33

(sorry if I am just missing something in what you posted above?)

dcj15:03:55

To be specific: Enhance despstar to support generating additional pom "stanzas" (e,g, description, url, licenses., developers, distributionManagment, and scm) via exec-args data. Most of those stanzas are populated with relatively static text, so super easy. The scm stanza contains tag and filling that in requires accessing that info from the SCM system, depstar does this today elsewhere in order to fill in the same info in pom.properties so should be straightforward to implement.

seancorfield17:03:26

@dcj quite a bit of that is already in clj-new which seems to be the better place for it.

dcj17:03:11

OK, I will take a look at that.

seancorfield17:03:12

As I said, depstar itself does not need pom.xml.

seancorfield17:03:09

clj-new has a generator system which is designed for updating files.

dcj17:03:49

AFAICT, What I am failing to communicate is the/my goal that in many/most cases pom.xml should be generated (in its entirety) when needed, and if that can be done, there is no need to have a distinct pom.xml in one's project repo, just generate it when you need it

dcj17:03:44

Generate it when needed using depstar, info/data within deps.edn, and info obtained from the state of the SCM

3
deactivateduser22:03:53

FWIW I’m a bit late to this conversation, but I 100% agree with you. deps.edn files today are already being “stuffed” with additional elements that the core tools.deps code doesn’t understand / read, and I see no reason why that approach can’t be extended to provide all of the elements a comprehensive pom.xml generator would need. I would also vastly prefer not to have a partial pom.xml file sitting in my checked in code - it’s incidental complexity that confuses some newcomers / casual perusers of my projects, as well as some tooling.

3
dcj17:03:57

If that is a bad/unnecessary/infeasible goal, then no need to discuss the implementation details 🙂