librelist archives

« back to archive

Fwd: Project specific task

Fwd: Project specific task

From:
Date:
2012-10-19 @ 08:59
I have been trying to figure out the best way to set up a project specific
build script that has its own dependencies.


* create a full plugin with project.clj and call it lein-projectname-build

This is the only method that currently works for me.

Problem with this approach is that a second project.clj with duplicate
dependencies has to be maintained, and ideally I'd like to call the task
just "build" instead of "projectname-build".

* create tasks/leiningen/build.clj and echo tasks >> .lein-classpath

The dependencies of the build script can be listed in dev-dependencies, but
it won't work unless :eval-in is set to :leiningen.

The problem with setting :eval-in to :leiningen is that on OSX I get the
following error (not on debian linux for some reason):
"Compilation failed: java.io.IOException: No such file or directory,
compiling:(testproj/core.clj:1)"

* use the lein-exec plugin

The problem with lein-exec is that the project has its own private s3
repository configuration but lein-exec currently only fetches from maven
central and clojars.


Is there a better way? Is there something that I'm missing?

Kind regards
Tobias.

Re: [leiningen] Fwd: Project specific task

From:
Phil Hagelberg
Date:
2012-10-19 @ 16:44
On Fri, Oct 19, 2012 at 1:59 AM,  <ts@girigiri-software.com> wrote:
> I have been trying to figure out the best way to set up a project specific
> build script that has its own dependencies.

If you have code that needs to run inside your project, you should use
`lein run -m my.project.build`.

Plugins and .lein-classpath only make sense if for some reason you
need to run code inside Leiningen's process itself. It's pretty rare
that you would need to write new code to do this for which a plugin
doesn't already exist, but if so you almost certainly would be better
off creating it as a separate plugin rather than coupling it to your
existing project.

-Phil

Re: [leiningen] Fwd: Project specific task

From:
Date:
2012-10-20 @ 08:59
On Fri, Oct 19, 2012 at 6:44 PM, Phil Hagelberg <phil@hagelb.org> wrote:

> If you have code that needs to run inside your project, you should use
> `lein run -m my.project.build`.
>

Thank you. I was not aware of the -m flag. It now totally makes sense to
use it for my build script.


> Plugins and .lein-classpath only make sense if for some reason you
> need to run code inside Leiningen's process itself. It's pretty rare
> that you would need to write new code to do this for which a plugin
> doesn't already exist, but if so you almost certainly would be better
> off creating it as a separate plugin rather than coupling it to your
> existing project.
>

I understand now that I don't have to write the build script as a plugin,
since it doesn't have to run in leiningen.

I wonder though whether what you said means that having a project specific
build script is discouraged? I assume that's the case since the -m flag is
never mentioned in the context of writing a project specific build script,
and since PLUGINS.md mentions using a tasks/leiningen/task.clj file for
project specific tasks.

I think that the ability of writing a project specific build script with
its own dependencies is a very important thing to have in larger projects.
I definitely don't want to describe a complex build process only with
configuration. That's what maven got wrong in my opinion.

Kind regards,
Tobias.

Re: [leiningen] Fwd: Project specific task

From:
Phil Hagelberg
Date:
2012-10-22 @ 19:00
On Sat, Oct 20, 2012 at 1:59 AM,  <ts@girigiri-software.com> wrote:
> I wonder though whether what you said means that having a project specific
> build script is discouraged? I assume that's the case since the -m flag is
> never mentioned in the context of writing a project specific build script,
> and since PLUGINS.md mentions using a tasks/leiningen/task.clj file for
> project specific tasks.

Yeah, I'll update the plugin guide to mention that. It doesn't have
anything to do with plugin development, but it's a common confusion
for people to have.

-Phil

Re: [leiningen] Fwd: Project specific task

From:
ts
Date:
2012-10-23 @ 08:46
On Mon, Oct 22, 2012 at 9:00 PM, Phil Hagelberg <phil@hagelb.org> wrote:

> On Sat, Oct 20, 2012 at 1:59 AM,  <ts@girigiri-software.com> wrote:
> > I wonder though whether what you said means that having a project
> specific
> > build script is discouraged? I assume that's the case since the -m flag
> is
> > never mentioned in the context of writing a project specific build
> script,
> > and since PLUGINS.md mentions using a tasks/leiningen/task.clj file for
> > project specific tasks.
>
> Yeah, I'll update the plugin guide to mention that. It doesn't have
> anything to do with plugin development, but it's a common confusion
> for people to have.
>
> -Phil
>

Thank you for the feedback. I have been reading too much into it :-)

Kind regards,
Tobias