-
Notifications
You must be signed in to change notification settings - Fork 414
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
Issues with Micronaut and Visual Studio Code with Java #693
Comments
so we should see extra class files automatically generated in the test ouput directory? |
Yes that is correct |
Ok so the gradle integration, I need to look at separately, because the eclipse/buildship/gradle combo does its own thing and I'm not too familiar with gradle. As for the Maven integration, I was able to reproduce the same behavior in Eclipse, where no extra test classes were generated under target/test-classes, when you import the project. The next problem is, when running HelloControllerTest, the test is still skipped. No idea why for now. |
@graemerocher skipped test is a micronaut issue. Fresh clone of the project then
|
@fbricon yeah it looks like Maven is not applying the annotation processors to the test source code the same was as Gradle. I am investigating the issue |
Chances are, once the problem with Maven skipping the tests is fixed, it'll also work in Eclipse, then in VS Code |
I pushed some changes to the |
I cannot reproduce the problem in eclipse (using the master of jdt, m2e and m2e-apt), but maybe because of the pom.xml changes. |
@fbricon @graemerocher Could you try to add the following dependency:
|
Yeah I confirm adding the micronaut-test-spock dependency immediately triggers proper generation of test byte code. Without even touching the .factorypath. Since most of the dependencies are groovy stuff, I thought adding junit:4.12 to the dependencies instead would do the trick, but no dice. There's something fishy here, related to spock. @snjeza any idea why? How did you find out about spock? |
@brychcy I get the exact same behavior in Eclipse 2018-12 M2 |
I have reviewed the log and noticed that io.micronaut.test.extensions.spock.MicronautSpockExtension is missing. |
Wow, I don't know how I missed that 🤦♂️
@graemerocher does it make sense? I need to figure out why Maven CLI adds it to the classpath, but it is ignored in m2e |
@fbricon It does make sense. Note however the missing Spock dependency is by design. We support Spock and Junit 5 with only one needing to be on the class path Although the annotation does reference a class that is not there. This is not an issue with javac nor an issue with Spock or Junit at runtime I don’t want users to have to use 2 different annotations for each framework so what we will probably do is try and catch the exception in our annotation processors However to me this is a bug in the Eclipse APT support as it behaves differently to javac and runtime Java |
I filed https://bugs.eclipse.org/bugs/show_bug.cgi?id=541466 to track this issue in the Eclipse APT implementation |
@graemerocher when's the next release of micronaut-inject containing the fix? |
@fbricon Either today or tomorrow, just wrapping up the last few issues |
Maven flavour of helloworld-java now works OOTB (once you set To get JDT APT support for Gradle projects, you need explicit .factorypath, .settings/org.eclipse.jdt.apt.core.prefs, .settings/org.eclipse.jdt.core.prefs manipulation in the build.gradle file. The process is documented here. |
Yes it does, closing this now. Thanks! |
FTR, providing OOTB annotation processing support for Gradle requires Gradle/Buildship to be enhanced. Go vote for it. |
Annotation processing for Micronaut maven projects is not working. |
I had a chat with @fbricon at CodeOne and we got the basics of Micronaut working with Code however there are a couple of areas that I can't seem to get to work.
src/main/java
, but tests don't work because the processors are not applied tosrc/test/java
.Environment
Steps To Reproduce for Gradle
cd hello-world-java
gradle eclipse
code .
Current Result
The application can be run but if you hit
http://localhost:8080/hello/john
you receive a 404 and although the tests pass they pass because the test is skipped because it isn't configure as a bean.Expected Result
The test should not be skipped and
http://localhost:8080/hello/john
should not 404Steps To Reproduce for Maven
cd hello-world-java
build.gradle
(so that VSC uses thepom.xml
)code .
Current Result
The result is better than with Gradle, the application can be run and if you hit
http://localhost:8080/hello/john
you get the right result. This means the annotation processors are applied tosrc/main/java
.However if you run a test the test is skipped because the annotation processor are not applied. If you however run
./mvnw test
the test is not skipped because the processors are appliedExpected Result
The test should not be skipped because annotation processors should be applied to test sources.
The text was updated successfully, but these errors were encountered: