Make IntelliJ IDEA run JUnit tests with -parameters javac option - intellij-idea

Is there a way to ensure the -parameters option is passed whenever running JUnit tests from IntelliJ IDEA?
If it's impossible to set globally, it would even help to set it for specific Run/Debug configurations.

The -parameters option is a Java compiler option, so it affects how the code is compiled, not how it is run. You can add it in Settings | Build, Execution, Deployment | Compiler | Java Compiler | Additional command line parameters.

Yes, you can do it that's way :

Related

Add JVM parameter to sbt shell configuration in IntelliJ

I have to set an additional library path -Djava.library.path=/x/y/z in order to execute run / debug tasks using SBT, otherwise I get a NoClassDefFoundError. Where can I do this in IntelliJ IDEA?
You could add additional parameters in "Settings | Build... | Build Tools | sbt"

IntelliJ 14 + gradle issue with system properties in test

This is snippet from my build.gradle file:
test{
systemProperty "test", "test"
}
Then I have my test code which looks like this:
#org.junit.Test
public void test(){
Assert.assertEquals("test", System.getProperty("test"));
}
And when I run this test from command line it is passing. If I choose in gradle window task test and click right mouse button and then select run this test also pass. However when I go to test itself and select run on method name it does not pass. It looks like in the third case IntelliJ completely ignored gradle context. Is there something that can be done to make this test work when running directly from IDE? Thanks in advance for reply. Gradle version 2.3.3 and IntelliJ 14.0.2
IntelliJ doesn't currently understand such configuration. To fully solve this category of problems, IntelliJ will need to use Gradle as its underlying build/execution engine, like Android Studio already does today. Until this happens (or support for this specific use case is added to IntelliJ), you'll have to define the same system property in the IntelliJ run configuration (template).
If you use the IntelliJ project generation approach (gradle idea), you can (with some effort) make Gradle generate such a run configuration (template). This is something we do for Gradle's own build.
For IntelliJ you need to add your System Property -Dtest=test to Gradle VM options within Settings > Build, Execution, Deployment > Build Tools > Gradle

how to set up an automatic compilation of test classes?

Intellij idea not compiles special classes when running test. Now I run the compilation manually via activator console. How can I customize the intellij idea to run automatically when start a compilation of test?
I'm not sure if I got you right but you can try to right click your test class and choose "Run [your_class]". It will compile the needed classes.

Verbose AspectJ compiler output

I wonder if there any way to make compiler's output in IntelliJ IDEA more verbose. IDEA automatically sets up compiler to ajc from maven dependencies.
I assume that it can be not IntelliJ IDEA's problem. May be ajc needs additional arguments ?
Thanks.
This message is rather from IDEA itself, not from Ajc.
AspectJ support in IDEA is still work-in-progress so it's better to use latest IDEA version (10.5 at the moment).
Please make sure that compiler is properly set up (File | Settings | Compiler | Java Compiler). Use "Test" button there.
Check IDEA logs for any related messages or exceptions.
If still no progress please file an issue to JetBrains tracker.
Still having this issue with 2019.1.
I found the log with the full exception in "~/.IntelliJIdea2019.1/system/log/build-log/build.log"

Can maven-exec-plugin fail the build?

I have a maven execution that runs a javascript compressor as a command line program, however, this tool also does some jslint checks as well.
If these jslint checks fail so should my build.
These errors are output as a parseable string to stdout.
If this maven plugin cannot solve this problem, I'm happy to use any other suggested.
Thanks.
To my knowledge, exec:exec will fail the build if the return code of the executed command is not 0 (or one of the configured successCodes). Maybe you can build something around this.
As an alternative, have a look at these plugins, they both can fail a build on problems:
the Jslint Maven Plugin
the YUI Compressor Maven Mojo
Depending on what you need exactly, there is also the Maven Javascript Plugin.
And also have a look at this Maven plugins for javascript question.