IntelliJ IDEA 11.1.2 does not copy SQL files to the out folder - intellij-idea

I am using IntelliJ IDEA 11.1.2 Ultimate with Gradle 1.0 multi module project. One module represents the domain.
The projects output is points to [project-root]\out. But if I run a unit test the output folder of the domain module does not contain any .sql files at all. . This is how I run the JUnit test within IntelliJ IDEA .
If I run the project using Gradle from command line everything works fine.

Settings | Compiler | Resource Patterns, add the pattern for the sql extension.

Related

IntelliJ run Scalatest using $MODULE_WORKING_DIR$?

I have a multi-project SBT config that I've imported into IntelliJ (2019.3). I want each project (module) to run Scalatests from its own directory instead of the multi-project root directory. I went to Run -> Edit Configurations -> Templates -> ScalaTest and set Working directory to $MODULE_WORKING_DIR$, but I get the following error:
"Cannot start process, the working directory '$MODULE_WORKING_DIR$' does not exist".
I am able to use the $MODULE_WORKING_DIR$ macro in my normal run configurations, but it doesn't work in ScalaTest. Is there something I'm doing wrong, or is there a different way to accomplish what I'm trying to do?

Gradle dist folder on IntelliJ classpath

We have a project which we build with gradle. We use IntelliJ as our development environment.
We have some resources we want to keep outside the JAR and so we have put them in the src/dist-folder. This works fine when running the application from the command line, but not so good when we want to debug from IntelliJ.
We could put a runtime-dependency to src/dist, but then we end up with files inside our lib-folder in the generated ZIP file and that's not what we would like to have.
Bottom line: how can we keep some resources outside the JAR (in src/dist) and also on the classpath of IntelliJ (as generated by Gradle; I don't want to have to add things manually to the IntelliJ classpath). The directory structure in the resulting zip should be something like:
root
|
|- config/*
|- css/*
|- lib/*
It seems that this question describes a similar problem, but the solution in addition #4 still mentions that no solution was found to correctly get the resources on the classpath of IntelliJ:
Gradle build file with conf folder with properties not in jar but on classpath
The solution I've used in a similar situation is to:
Use the Idea plugin in gradle rather than relying on the IntelliJ support.
Once that is working you can tweak the source path that IntelliJ uses in the gradle file itself

Using Gradle to Build an IntelliJ Module From Command Line

I understand the basic functionality of gradle, but I don't understand how to use a build.gradle file other than the one in the project's root. I have a project which contains a gradle wrapper in it's root, and a module which has it's own build.gradle file. How do I specify for gradlew to use the module's build.gradle file instead of the one in the root directory?
Specifically, I have an IntelliJ project I have uploaded to my CI server, and I am trying to setup a script to run the builds automatically.
Cheers
It looks like you have a multi-module build which only has a single module... correct?
You could include a settings.gradle which points to the module
You could declare a GradleBuild task in the root module to invoke the sub module.
A good place to look for inspiration is the java samples and the organizing build logic page in the documentation. An impressive feature of gradle is that all of the code snippets which appear in the documentation is sourced from the samples directory which is run as part of their CI build.
Happy Gradling!

Add Jpa Metamodel generated files using Gradle idea plugin to Intellij Idea sources

I'm using the idea plugin on a Gradle multiproject configuration to generate the Intellij configuration files. At the moment the build is working fine in Gradle, but it gives me errors on the IDE due to the missing JPA Metamodel source files.
My question is, how can I place the generated .java files in a different folder and set them as a source folder for the modules in Intellij?
Currently I'm trying to send the parameter -s to javac but I keep getting the error invalid flag: -s...
Depending on how you want the generated source files to be compiled, the solution may be as simple as adding the source files to the main source set:
sourceSets.main.java.srcDir "build/generated-files" // adapt as necessary
Additionally, compileJava will need to depend on the task that generates the sources.

How to configure IntelliJ IDEA and/or Maven to automatically add directories with Java source code generated using jaxb2-maven-plugin?

In our project we are using jaxb2-maven-plugin to generate Java source code from XML Schema, which causes that our Maven module requires additional source code directory (in our case target/generated/main/java). Up to date I've been using Eclipse and maven-eclipse-plugin to import all the projects into Eclipse workspace. The plugin is (somehow) able to add the directory with generated source code automatically to Eclipse' .classpath file.
Recently I try to switch to (play with?) IntelliJ IDEA 9 (so I am a newbie in this environment) and I've noticed that additional source directory is not added during IDEA's importing process...
Is there any way I can configure IDEA/Maven to make importing directory with generated source code automatically?
The convention with Maven is to generate code in target/generated-sources/<tool>, for example target/generated-sources/jaxb2
Follow this convention and IDEA will add the folder as source folder (see IDEA-53198).
Generated code, using jaxb2-maven-plugin, was missing for me in Intellij 2017.1 whereas Eclipse Neon created it.
Fixed it from context menu of module by selecting 'Maven -> Generate Sources and Update Folders'.
Try with maven-jaxb2-plugin. If it does not work then it's IDEA problem.
In Maven you can add new source roots per configuration. Maven plugins can do this programmatically. This is for sure the case with maven-jaxb2-plugin. Then, if IDEA does not recognize it, then it's a problem on that side.
You can use the Maven Build Helper Plugin. It is located at http://www.mojohaus.org/build-helper-maven-plugin/
It allows to configure additional source roots. And the maven integration of IntelliJ will add the new source root. We are using this feature in quite a few builds and it works just fine. Tested with vers. 13 of IntelliJ IDEA.