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

Feedback #3

Open
guillaumeLamanda opened this issue Jun 8, 2023 · 7 comments
Open

Feedback #3

guillaumeLamanda opened this issue Jun 8, 2023 · 7 comments

Comments

@guillaumeLamanda
Copy link
Contributor

Hi 👋

I saw this project here, and @andy-bell101 was asking for feedback.

I sporadically work on a maven project with JUnit tests, so I try it.

For now, when I try to open the summary I get this error:

   Error  09:12:37 notify.error lazy.nvim Failed to run `config` for neotest

...l/share/nvim/lazy/neotest-java/lua/neotest-java/init.lua:300: attempt to call global 'is_callable' (a nil value)

# stacktrace:
  - /neotest-java/lua/neotest-java/init.lua:300 _in_ **setter**
  - /neotest-java/lua/neotest-java/init.lua:311
  - ~/.config/nvim/lua/plugins/testing.lua:61 _in_ **config**

And when I try to run a test, I have the following error:

   Error  09:15:27 msg_show.emsg E5108: Error executing lua: ...im/lazy/LazyVim/lua/lazyvim/plugins/extras/test/core.lua:81: attempt to index field 'run' (a nil value)
stack traceback:
	...im/lazy/LazyVim/lua/lazyvim/plugins/extras/test/core.lua:81: in function <...im/lazy/LazyVim/lua/lazyvim/plugins/extras/test/core.lua:81>

The project use maven.

Thanks for the initiative with this project, I hope this feedback will help

@andy-bell101
Copy link
Owner

Looks like I just assumed the is_callable function exists from looking at someone else's code but it doesn't. I'll get a fix in tonight. Not sure about the second error. Hopefully fixing the first error fixes the second one?

@andy-bell101
Copy link
Owner

Ok the first issue is fixed in the latest commit. Hopefully the second issue resolves itself after you update

@guillaumeLamanda
Copy link
Contributor Author

guillaumeLamanda commented Jun 9, 2023

I tried your update. The test wasn't running. I fixed it from the PR linked above.
Now, I have another issue: the test success but the plugin tells it has failed.
I also have the following notification:

17:11:16 msg_show /Users/guillaumelamanda/zenika/pleenk/pleenk-redesign/projects/backend/build/test-results/test is not accessible by the current user!

The test result is in target/surefire-reports/TEST-com.pleenk.backend.modules.topup.domain.TopUpTest.xml.

@andy-bell101
Copy link
Owner

Looks like Maven puts things in a different place to Gradle. I'll have to add some logic in so it can find the files. Is this project something I can access or is it private? Would make testing it easier

@guillaumeLamanda
Copy link
Contributor Author

Sadly the project is private. 😬
I fixed the maven example in the repo (thanks to my colleague @madbrain 🎉 ) in the PR

@andy-bell101
Copy link
Owner

Just merged. Thanks for your help :)
I'll see if I can find a public Maven based project somewhere

@asmodeus812
Copy link

asmodeus812 commented Oct 9, 2023

One thing to note, not sure if handled already, but the java_home has to be explicitly set/resolved based on the project's current settings, otherwise it will run maven for example with whichever is the default one in the current env. This might be a problem since you might have one project running or being configured for java11, but have a different java_home configured in your env. On a daily basis, i interact with multiple projects configured with different versions of java, from 8 to 20. The way i had resolved this in the past, for an adhoc build solution in my config, is pulling the current runtime from jdtls, using a request command -
"java.project.getSettings", with the following arguments
local COMPILER = "org.eclipse.jdt.core.compiler.source"
local LOCATION = "org.eclipse.jdt.ls.core.vm.location"

The request will return the location of the vm, which is the one for the current project, which can then be set to the java_home in the env table, before running jobstart for mvn. That will only work if the user has configured the vm locations when creating the jdtls configuration - for example. Probably relevant for gradle, but i know maven picks up only java_home, you can't really pass it as command line arg to mvn itself, to tell it which sdk to use.

{
    "java": {
        "configuration": {
            "runtimes": [
                {
                    "default": true,
                    "name": "JavaSE-17",
                    "path": "/home/linuxbrew/.linuxbrew/Cellar/openjdk@17/17.0.7/libexec"
                }
            ]
        }
    }
}

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