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

modulePath not resolved from PklProject #5

Open
jontro opened this issue Feb 5, 2024 · 2 comments
Open

modulePath not resolved from PklProject #5

jontro opened this issue Feb 5, 2024 · 2 comments

Comments

@jontro
Copy link

jontro commented Feb 5, 2024

I have the following directory layout

project/PklProject
project/.pkl
project/src/main/resources/Application.pkl

In PklProject I have set the modulePath as following

amends "pkl:Project"

evaluatorSettings {
  modulePath {
    "./src/main/resources"
  }
}

In .pkl

amends "modulepath:/Application.pkl"

// amendments here

Evaluating using pkl cli works fine: ~/pkl eval .pkl

However in IntelliJ I get an unresolved import. The PklProject file is synced.

@stackoverflow
Copy link
Contributor

PklProject and modulepath don't interact very well right now. That's something we want to improve in the future.
For now you can use direct package imports (import "package://...") instead of a PklProject to get around this issue.

@jfharden
Copy link

jfharden commented Mar 5, 2024

Worth adding that this is also true of dependencies brought in with a friendly name. e.g.

PklProject

amends "pkl:Project"

dependencies {
  ["concourse_pipeline"] {
    uri = "package://pkg.pkl-lang.org/github.com/alphagov/pkl-concourse-pipeline/[email protected]"
  }
}

If in a pkl file I then use it by the name concourse_pipeline it can't be resolved:

import "@concourse_pipeline/Pipeline.pkl"

class PayGitHubResource extends Pipeline.Resource {
    type = "git"
    icon = "github"
}

However if I use the full package import path it works fine:

import "package://pkg.pkl-lang.org/github.com/alphagov/pkl-concourse-pipeline/[email protected]#/Pipeline.pkl"

class PayGitHubResource extends Pipeline.Resource {
    type = "git"
    icon = "github"
}

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

3 participants