Grails 3.0 adding an inline plugin - grails-plugin

I created simple grails 3.0 applications using commands below:
create-app admin --profile=web
create-plugin core --profile=plugin
Now, I wanted to use core as an inline plugin in admin build, which is a web application.
We can easily do that in grails version < 3.0 in buildconfig. Where can I do that in grails 3.0. Every help is worth appreciated.

Recently I used an inline plugin in my grails 3 application. here is how I did it-
Make sure that your application and your plugin are on same parent directory.
Now go to build.gradle file of your application.
Add this line in dependencies:
compile project(':plugin_name')
Now go to settings.gradle file on your application and append these lines:
include 'plugin_name'
project(':plugin_name').projectDir = new File('absolute_path_of_pluin')

Inplace plugins have been replaced by multi project Gradle builds. See the Grails 3 functional test suite for an example https://github.com/grails/grails3-functional-tests

Related

Can't produce an executable jar from Spring Boot, Gradle, and IntelliJ-Idea

I have created a Spring Boot Microservice using IntelliJ-Idea and Gradle as the build engine. I have made no changes to the initial Spring Boot configuration. I also have made no modifications to the build.gradle file provided. I built the application using starter.spring.io through IntelliJ-Idea and have the following dependencies:
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-devtools')
compile('org.springframework.boot:spring-boot-starter-web')
runtime('org.postgresql:postgresql')
testCompile('org.springframework.boot:spring-boot-starter-test')
The application currently contains 12 classes and 2 interfaces and is a Web Service provider. It runs fine on my system but when I build with Gradle, the Manifest.MF contains no Main-Class entry.
I created a very simple Hello World app and tried several combinations of IDE’s and build tools(Gradle and Maven)
and got the following results:
 
 
Interestingly, I was able to produce executable jars in Eclipse which has a separate Runnable JAR Export process.
I'm fairly new to IntelliJ and Gradle. Has anyone see this behavior before? Any ideas what I might be doing wrong in IntelliJ? I have my Hello World project zipped up if anyone needs it.
I took the advise of M. Denium and I did the Gradle build from the Command Line. The jars created were formatted correctly to be executable. Everything worked like a charm. In fact the Main-Class is a Spring Boot class called org.springframework.boot.loader.JarLauncher and the main class for my app was in a property called Start-Class. The IDE totally misses this.
Looks like you will need to include spring boot plugin for gradle - org.springframework.boot:spring-boot-gradle-plugin
More details in the gradle section of the getting started guide

Getting contents and natures of all projects in a Maven build

Currently I'm working on a Maven plugin that should generate files in all projects (OSGi bundles) that have a certain Eclipse project nature.
How can I access the contents of the projects included in the build and the project natures by using the Maven API?
Maven is a standalone build tool, not an Eclipse plugin. You cannot access Eclipse project settings from core Maven API.
Eclipse supports Maven with the M2E Eclipse plugin. It is possible to write M2E extensions and in the extension you can query the project natures via the functions of AbstractProjectConfigurator class.
However, M2E extensions will not run when you compile your code in the command line. I suggest that you choose one of the followings:
Write an Eclipse plugin that generates the source code into the src folder of the maven project. Code generation should be started by the user manually (selecting a context menu in the project or something).
Avoid using Eclipse project natures and solve your questions based on analyzing the source and pom of your project.
If you need to react on certain aspects in the source code like it looks from the thread with Balazs then you can simply write an ordinary maven plugin and include it in the parent pom. It will then run in every project and can analyze the code and react based on it.

How to compile/build restlet 2.2 modules?

I have cloned the restlet codebase from github and I am working on 2.2 branch. However I am not able to build the modules as it doesn't have pom.xml in any of the module.
I have previously worked with restlet 2.1 branch wherein I was able to compile the modules without any problem.
How do I build modules ? Can I just copy the pom.xml from 2.1 branch or is there any specific process for 2.2
It's actually built with ant from the build sub-folder
https://github.com/restlet/restlet-framework-java/tree/2.2/build

IntelliJ 12 Grails 2.1 Configuration - Grails SDK not configured

I feel like I'm missing something simple at this point. I upgraded to grails 2.1.1 from 1.3.7 while running IntelliJ 10, recently I upgraded to IntelliJ 12 and imported all settings. Somehow in the project in IntelliJ 12, I have no grails SDK.
My Global Library has grails 2.1.1 defined with all the correct .jars included, however, the Tools menu is missing the "Grails" sub-menu, and attempting to run the app gives the error message that Grails SDK is not configured.
If I create a new project for grails, the SDK configures correctly and Grails shows in the Tools menu. What am I missing preventing me from adding the Grails SDK to this project? Thank you, community, for your time and suggestions.
You do not have to create a new project.
Had the same problem, and it took me quite some search to resolve it:
right click your Grails module
click "Add framework support"
select "Groovy"
The dropdown next to "Use library" will allow you to choose a grails library.
If the dropdown is empty press "create" and choose your grails library directory.
Grails SDK is configured then
With Intellij 16 right click on your project in the right hand project pane.
Choose Grails->Configure Grails SDK.
If you're using the grails wrapper I would point to that SDK:
/Users/your user/.grails/wrapper/2.5.2/grails-2.5.2
I have the IntelliJ 12 too, to run app i just click in 'File' -> 'Create Project', select 'Grails Project'
Click Next,
Click em Create, select the folder, who contain the Grails 2, and Voila. :-)
If you has the project before, run in project 'grails integrate-with --intellij' or run import project, and create a Grails SDK
I found a symlink that points to the latest version in:
~/.sdkman/candidates/grails/current
I'm using SDKMAN 4.0.37
Pointing Intellij at that location will allow you to switch versions using sdkman.
Not really an "answer" here, but after seeing similar troubles with IDEA I went ahead and just created a new project and copied my source in and resolved my issues, if not solving the actual problem.
I am working with IntelliJ 12.0.1 ultimate.
I have installed Grails 2.3.1 on my computer, but always got errors when trying to specify it as a Grails SDK-
"failed to create library. Looks like Grails distribution in specified path is broken. Cannot determine version."
I tried with Grails 2.3.0, but got the same error.
Then, I tried my luck with Grails 2.2.4, and I could finally get it work.
Creating a New Project will actually not overwrite any existing code; just point it at your existing project directory, select Grails and open it up.
Your project will now complain that there is no Grails SDK; just point it at your Grails dist and you are good to go.
Recently, I've encountered a similar type of issue. I have the grails SDK folder, but OK Button not enabled when trying to configure from the project. Then we have installed the Grails Plugin in IntelliJ. Then OK Button enabled and grails SDK is configured into project.

How to use Grails Dependency cache in IDE?

Is there a way to use the ivy cache grails dependency DSL creates within an IDE like eclipse or netbeans? Or must I manually add all dependencies to the IDE lib folder?
I've looked into plugins like ivybeans and ivyde, but they seem to require ivy.xml and ivysettings.xml files, which grails does not produce.
The Grails tooling provided by the SpringSource Tool Suite plugin for Eclipse has the functionality you desire. It reads BuildConfig.groovy and modifies the project classpath accordingly.
I just attached the following to the Jira bug.
In snooping around the STS distribution, I found the following code in
C:\springsource\sts-2.3.2.RELEASE\configuration\org.eclipse.osgi\bundles\898\1.cp\src\com\springsource\sts\grails\core\model\GrailsBuildConfig.java
// make sure that we use the Ivy dependency resolution strategy for Grails 1.2
// TODO CD make version number detection more flexible
if (settings.getGrailsVersion().startsWith("1.2")) {
jarFiles.addAll(settings.getTestDependencies());
jarFiles.addAll(settings.getProvidedDependencies());
Based on this find, I tried downgrading my project from Grails 1.3.2 to Grails 1.2 and ran "refresh dependencies". Sure enough, the dependencies were correctly loaded from Ivy.
Looks like someone needs to do the TODO. I can take a stab at it once I figure out how to check out the source code...
IntelliJ syncs dependencies between Grails (form application.properties and BuildConfig.groovy) and the IDE very nicely.