Install Plugin jar in Grails Project? - java

I have a grails plugin project and want to make a jar which I then include into my grails project.
Here is the plugin project: https://github.com/ticketbis/grails-groobalize
I did:
grails package-plugin --binary
To get the file: grails-plugin-groobalize-0.1.12.jar.
In my grails project's BuildConfig.groovy I did:
dependencies {
compile "com.ticketbis:groobalize:0.1.12"
}
When I run grails refresh-dependencies I get the following error:
Error |
There was an error loading the BuildConfig: Bad artifact coordinates :groobalize:0.1.12, expected format is <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version> (Use --stacktrace to see the full trace)
How do I install the locale plugin jar into ma grails project correctly?

There are a few ways of doing this.
You can use the release plugin: https://grails.org/plugin/release
Add this plugin to your grails plugin and then do a publish. The plugin will then be added to your local maven repo.
The you could add the dependency in your main grails project as you
have already done.
Other way around is to checkout the plugin project, include the location in your main grails project like below.
BuildConfig.groovy
grails.plugin.location.'your-plugin' = "<location-your-plugin>"
This line will compile your plugin every time you compile your main grails project.
There may be other ways too.

Related

Having build.gradle next to pom.xml

I've had a java maven project, and now I converted to gradle because I have to write some cutom build script.
I'm wondering if I still need to keep pom.xml. Do I need to add my dependencies to pom.xml, or I should get rid of pom.xml and add them to build.gradle ? Does gradle replace maven ?
Gradle and Maven are two different build systems. They are quite the same but have some differences. But if you convert your maven project to gradle, then your pom.xml is useless from now on. You can easily convert your maven project to gradle using gradle's incubating feature with this command gradle init --type pom. Then your scripts will be added to build.gradle file. This is still an incubating feature though. You can also do it from stract. I suggest you to read the following document.

GWT maven build eclipse

I had a GWT app, and I wanted to automate its build and deploy system, since I do it manually. But I did not find a way how to build the app from command line, so it can than be automated. I had to click the Google button, then compile GWT project and then click Compile.
I found out that it is possible to create a GWT maven project and that it should then be possible to compile my project from commandline with mvn gwt:compile.
So I created a new project using this plugin. Copied my sources from the old project to this new one.
Now the structure is like this:
/src
---/main
------/java -> here are all my sources including my Project.gwt.xml file.
------/webapp
---/test
pom.xml
Now I have 2 problems.
1. I thought that I add dependencies to the pom.xml, and then when I build the app, it will create the jars and I can use those libraries in my GWT app. I guess 'mvn clean install' should do this, but so far I'm getting compile errors.
2. I did not get mvn clean install to work, so I added all the jars manually again... And then yes! I was able to build the app using the plugin GWT button! So I was thinking that now I can use 'mvn gwt:compile', but it fails with:
Unable to find: "com/company/project/Project.gwt.xml" on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
EDIT:
So I fixed my <moduleName> element in pom.xml, so now it finds the Project.gwt.xml. I'm trying to run:
mvn clean install gwt:compile
But I am getting compile errors. I think, it tries to build my project without the actual dependecies because it tells few classes don't exist, but those classes are part of an external library. (specifically this one). But I have it in the dependencies, so I don't know what more to do.
<dependency>
<groupId>com.github.tdesjardins</groupId>
<artifactId>gwt-ol3</artifactId>
<version>3.0.0</version>
</dependency>
Also in eclipse I had to manually add the jars to my project, so that was why it worked there and not in the command line. So I would also like to ask how to tell eclipse to get those jars and include them to the project, because otherwise eclipse is missing those dependencies and displays many errors.
First I had a problem with <moduleName> in my pom.xml was missing com.company.project prefix before the actual module name.
Then I had errors in my Java files, which was caused by RELEASE version of GWT-OpenLayers 3 library missing some of the features that I previously used by building the JAR from the GitHub repository.

Error for gradle build for my Java project

I am trying to build the Java project located at here: https://github.com/garlicPasta/dotServer
I'm new to Gradle. I downloaded the latest Gradle now (v4.0). I added the bin folder of Gradle (which includes gradle.bat) to the path so I can run gradle command everywhere. Looks like the project requires Google protobuf which it downloads automatically. But when I start the command gradle build, I get the following error:
> Configure project :
You are using Gradle 4.0: This version of the protobuf plugin works with Gradle version 2.12+
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'dotServer'.
> No signature of method: org.gradle.api.internal.tasks.DefaultTaskInputs.source() is applicable for argument types: (com.google.protobuf.gradle.ProtobufSourceDirectorySet_Decorated) values: [main Proto source]
Possible solutions: collect(), use([Ljava.lang.Object;)
Where is the problem coming from? Can someone try to build the project and let me know?
I just upgraded to Android Studio 3 and had the same problem when I upgrade Gradle and it's plugin.
We use Google's Protobuf which was included in build.gradle with version 0.7.6. I just changed to 0.8.3 and it builds now.
buildscript {
...
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.3'
}
}

Eclipse build errors when using Gradle or Maven?

When using a build manager like Gradle or Maven, my dependencies are being managed correctly, however the Eclipse IDE is unaware of the resolved dependencies so it will still show errors and I cannot build through Eclipse, I have to run a 'build' command through the build manager.
How do you get Eclipse to be aware of the resolved dependencies taken care of by a build manager and running the app through the IDE?
You can generate Eclipse metadata using eclipse plugin distribute with Gradle - http://www.gradle.org/docs/current/userguide/eclipse_plugin.html - this will set up the project with its classpath.
Or install Gradle plugin for Eclipse developed by Pivotal folks.
The question is vague. Using m2e or Gradle plugin for Eclipse developed by Pivotal can lead you to different errors. You should ask exact question, sharing error that you got here on stackoverflow.

Gradle Java debugging project in IntelliJ IDEA

I've used previously maven 3 and it was easy to run anything from IntelliJ IDEA 13, be at main classes or tests - it worked through maven settings. But now I am trying to debug my java project in IDEA with Gradle 1.11. The problem is that idea now creates /out/* directory and trying to run my classes from there instead of using gradle settings and build setups - I mean, with maven I could debug my java project by this:
Set debug configurations
Run it under debug
2 step will call maven install and will run my java project from target/classes/ directory
But with gradle project idea not uses gradle structure.
How can I debug my java project right from IDEA IDE with gradle?
P.S. I can run gradle test under debug in IDEA and it works perfectly, but I need something like gradle debug or gradle run to set breakpoint in IDE, run my Main class and launch my java application through IDE. Hope it is clear what I want to do.
Problem was solved by using application plugin of gradle.
In build.gradle we need to apply this plugin by adding line:
apply plugin: 'application'
And setup main class name:
mainClassName = "Main"
(Main is my main class).
After that in IDEA we need to create configuration to run gradle's run-task and run it under debug.
But if you have a distribution plugin applied to in your project they will conflict. You need to delete the line of applying distribution plugin and any section of this plugin like distributions {...
Application plugin information

Categories

Resources