Skip to content

clj-new project naming  #224

Open
Open
@practicalli-johnny

Description

@practicalli-johnny

I'm trying out this library clj-new. One thing I'm trying to understand is that it has a syntax for creating a new app that it describes like this:

clj -A:new app myname/myapp

When you run this you get a directory structure that looks (in part) like:

src
|--myname
    |--myapp.clj

Can anyone explain to me why this tool likes to include the author's name in the directory structure?

When publishing a Clojure project it should have a unique group ID (and artifact ID) on clojars.org -- so this aligns with that. If you look in the generated pom.xml, you'll see that it would publish it as myname/myapp (with whatever version).

And if your project is going to be used by other people, you want it to not conflict with any of their code, so the namespaces should all have a unique stem. Your GitHub ID (your account name) is a good group ID and a good root namespace.

You could also choose your company name, or your company's reversed domain name -- the way org.clojure/clojure, org.clojure/java.data are set up.

What threw me about the username in the directory structure actually has more to do with the namespace structure. You end up with myname.appname rather than appname.namespace1. I feel like the latter is more familiar to me -- but admittedly I have zero experience publishing libraries.

If two people published something called appname with the namespaces like that, they would conflict and no one could use them both together. If their libraries have namespaces that start with myname (and yourname) then they can be used together.
It's why, for example, all of core and all the Contrib libraries have clojure as a prefix in their namespace names even tho' it may seem redundant.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions