Code Monkey home page Code Monkey logo

Comments (10)

hugoduncan avatar hugoduncan commented on May 19, 2024

I think this is caused by the cljx.plugin/middleware unconditionally adding cljx to the dependencies. As a workaround, you can specify the cljx plugin inside the :dev profile.

from cljx.

cemerick avatar cemerick commented on May 19, 2024

Yeah, @hugoduncan is right. I always put cljx in :dev, which explains the README inaccuracy.

It's been a long while since I've had my hand in lein pom stuff. What needs to be changed to prevent the dep from being included, regardless of the profile in which the plugin is situated? (Making the dep optional would be an easy fix, but I'd like the pom to be clean in all cases.)

from cljx.

hugoduncan avatar hugoduncan commented on May 19, 2024

I think that the cljx task should add the dependency, rather than doing it in middleware, assuming that the task is the only thing that requires the dependency being on the project's classpath.

from cljx.

weavejester avatar weavejester commented on May 19, 2024

Currently, Leiningen just unmerges the :default profile from the project map before generating the pom. The :default profile is defined as [:base :system :user :provided :dev], but can be overridden.

I can see several options here:

  1. Create a new :cljx profile for the dependencies, and add it to the :default profile.
  2. Add the dependencies to the :dev profile automatically
  3. Clearly document in the README that the plugin should be used in a profile, not at the top level.

I'm personally inclined toward option 1. It would give people the ability to turn cljx on and off just by toggling the profile, while at the same time providing unsurprising default behaviour when deploying or generating jars.

from cljx.

cemerick avatar cemerick commented on May 19, 2024

The dependency is also required at runtime for the REPL support, etc.

from cljx.

cemerick avatar cemerick commented on May 19, 2024

I've updated the README to demonstrate and advise :dev profile use.

Happy to take a PR that implements option 1 as described by @weavejester.

from cljx.

hugoduncan avatar hugoduncan commented on May 19, 2024

Some profiles for common configuration scenarios would be nice to add too. eg. cljx only source project with cljx sources under src, or a clj and cljx project (with src/clj and src/cljx). These profiles could be explicitly used by a consuming project to avoid repetitive and error prone manual configuration of the project.

from cljx.

cemerick avatar cemerick commented on May 19, 2024

Another thought: why shouldn't the dependency just be added in a repl task hook? Should eliminate all the profile business entirely.

from cljx.

weavejester avatar weavejester commented on May 19, 2024

I forgot to mention that I posted to the Leiningen mailing list about how best to solve this. @technomancy's response was that there isn't currently a good way of doing this in Leiningen as yet... though it appears as though @hugoduncan has submitted a PR along these lines.

from cljx.

cemerick avatar cemerick commented on May 19, 2024

A fix for this is now on develop/0.5.0, and available for testing as [org.clojars.cemerick "0.5.0-SNAPSHOT"]. The plugin's middleware now only adds the dependency if the :repl profile is activated, indicating that the REPL is about to start. In my testing, this prevents cljx from ever getting near the pom.

More capable profile/configuration management is an interesting notion, but I'd like to consider that separately, as long as the current proposed fix works.

from cljx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.