"Distribution with sources" feature kills Grails 3 projects in IntelliJ - intellij-idea

Create new Gradle 3 project, select all default values. You can test project that is runs. Then, stop the project and open build.gradle file. You will be prompted with a tip
(You can configure Gradle wrapper to use distribution with sources. It will provide IDE with Gradle API/DSL documentation)
Select Ok, apply suggestion
Now you will be unable to compile or run project anymore with the following error:
Error:Cannot compile Groovy files: no Groovy library is defined for module 'untitled1'
Is it possible to restore the project state back to normal?
UPDATE
Some block is absent in broken IPR file:
<component name="MavenImportPreferences">
<option name="generalSettings">
<MavenGeneralSettings>
<option name="mavenHome" value="D:/Apps/apache-maven-3.2.3" />
</MavenGeneralSettings>
</option>
<option name="importingSettings">
<MavenImportingSettings>
<option name="downloadDocsAutomatically" value="true" />
<option name="downloadSourcesAutomatically" value="true" />
</MavenImportingSettings>
</option>
</component>

Related

How to prevent Idea Intellij to change MODULE_DIR in IML files?

Using Intellij Ultimate 2020.2, in a multi-module Maven project, my IML files use the MODULE_PATH variable, like this:
<component ...>
<option name="directories">
<list>
<option value="$MODULE_DIR$/src/main/java" />
But when I refresh (switch branch, build, etc.) Intellij replaces MODULE_DIR by the reel path, for example:
<component ...>
<option name="directories">
<list>
<option value="C:/somepath/myproject/mywebapp/src/main/java" />
Is there a way to prevent Intellij to change the content?

IntelliJ file excluded from search, how to un-exclude?

I have somehow managed to exclude my webpack configuration from IntelliJ search results. It also now has a little cross on it as shown below. How do I re-add the content of this file to search results?
I have tried excluding the file from the Project Settings/ Modules/ Excluded files, and then removing it to clear the cache, but it still gets excluded. Thanks!
Please check your .idea/workspace.xml - do you have this .js file listed in <component name="TypeScriptGeneratedFilesManager"> section there, like:
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
<option name="exactExcludedFiles">
<list>
<option value="$PROJECT_DIR$/path/to/webpack.config.js" />
...
</list>
</option>
</component>

IntelliJ - Groovy start - Error: Cannot compile Groovy files: no Groovy library is defined

In similar questions I could not find a sufficient answer. I followed the IntelliJ tutorial for Groovy, but it did solve the solution. Finally I solved it via a 1A4 Maven file.
For getting started more easy, maybe you could help me and others with Groovy in IntelliJ.
What did I do:
I installed the Groovy SDK
I started IntelliJ, created a new Groovy project and I could see the library was added.
After creating my first Groovy class, a compile error mentioned:
Error: Cannot compile Groovy files: no Groovy library is defined
I double checked that the library is there. And I also added the library to the module via the File > project structure > libraries. I get this result:
Added on request: I added project structure > modules > dependencies:
How your .iml file looks like?
I repeated all steps from your message and have successfully run GroovyDemo.groovy class without any errors.
My .iml file is:
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="groovy-2.4.15" level="application" />
</component>
</module>
Make sure what you have groovy library inside. If you don't have it, you need to open project setting and add it manually into Libraries or Global Libraries.
I'm using IDEA 2018.1.6 UE. What is your version?
EDIT 1:
I finally reproduce your error.
I delete .idea folder from my project scope;
I open old project and it recreate the whole structure;
After that I see the same error when trying to run groovy class
I fix it by manually add groovy library to the project dependencies.
ctrl+shift+alt+s.place in Project Structure.then setting your Libraries,attending to your groovy install-file-folder lib--> groovy-***.jar。

SonarLint plugin IntelliJ with no authentication

Is it possible to connect to a remote SonarQube 5.6.1 server using the SonarLint 3.0.0 plugin for IntelliJ 2017.1 without using authentication by default? Currently the plugin seems to want either username/password OR token
There is a hack which you can use:
Normally sonarLint stores the information in your IntelliJConfiguration-directory in config/options/sonarlint.xml - you can simply paste following configuration into that file:
<application>
<component name="SonarLintGlobalSettings">
<option name="sonarQubeServers">
<list>
<SonarQubeServer>
<option name="hostUrl" value="<your-server-url>" />
<option name="name" value="test" />
<option name="login" value="" />
<password />
<organizationKey />
</SonarQubeServer>
</list>
</option>
</component>
</application>
which is the basic configuration for a server without authentication.
// EDIT: It seems like this was an intended change by sonarSource to sonarLint - https://groups.google.com/forum/#!topic/sonarlint/xnpQmXN8NEo - is the mailing list discussion about this

Step by step way to setup TeamCity and Gallio integration

I am very new to TeamCity. I found that some xml does the trick like
<Gallio IgnoreFailures="true" ...
but I do not know wher to put this. How to invoke this. What steps to add in TeamCity. I would be greateful for any tutorial.
1 To your solution add a library project.
2 Edit a project (adding section below) and commit.
<!-- put this in csproj almost at the end in target section -->
<UsingTask AssemblyFile="Gallio directory - wherever it is insalled\bin\Gallio.MSBuildTasks.dll" TaskName="Gallio" />
<ItemGroup>
<TestAssemblies Include="Path to your test project dll (ex ..\testProjName\bin\Debug\testProjName.dll" />
<!-- put as many TestAssemblies as you want -->
</ItemGroup>
<!-- name of the target is important to rememver. You will use it in Team City Configuration -->
<Target Name="RunTests">
<Gallio Files="#(TestAssemblies)" IgnoreFailures="false" ReportTypes="html" ShowReports="true">
<!-- This tells MSBuild to store the output value of the task's ExitCode property
into the project's ExitCode property -->
<Output TaskParameter="ExitCode" PropertyName="ExitCode" />
</Gallio>
<Error Text="Tests execution failed" Condition="'$(ExitCode)' != 0" />
</Target>
3 Add an MSBuild step to build configuration.
a) Runner Type: MSBuild
b) Build File Path: Relative path to the test project.
c) Targets: In example above target name is "RunTests"
d) Fill all other fields accordingly.
e) Save step
You should be already able to run and test your projects. If you believe that there is some other step that could be added here just edit my answer.
I have been looking for an answer for some time and found it partially on several sites, but nowhere as a whole. For example: other similar answer was not only partial, but had parameters that did not work in MsBuild 3.2.