I mistakenly added some jars to Grails dependencies using Java build path dialogue of GGTS.
Now I want to remove them.
But the build path dialogue offers no chance to do so.
Just remove the project from eclipse, delete .project and .classpath files. regenerate eclipse files using command grails integrate-with --eclipse and import the project again and you classpath should be good.
Related
is anyone knows how to change the jre libraries on java dynamic web project(I am using Eclipse and Maven)? The case is this, when I first created the project on Eclipse Oxygen package M5 the default jre was 1.6, I changed the Java Build Path(libraries) into 1.7/1.8, however upon updating the project it always returns to 1.6 and there is a red mark on the project folder. I already tried deleting the project and import it as Existing Maven Project and then update and clean but still nothing happens. This happens whenever I am creating a project without XML based configuration. I installed JDK 1.8.0 update 111, 121, and 131 and Apache Tomcat V7(XAMPP). On my brother's laptop everything works fine.
By the way, I also tried to replace .m2 folder of my laptop by copying .m2 folder from my brother's laptop.
Any help is much appreciated.
I assume you are using m2e, the Maven integration for Eclipse, which offers the import as Existing Maven Project option. m2e takes the version for the JRE System Library container from the configuration of the maven-compiler-plugin; this ensures that Eclipse and mvn behave consistently. Try changing the <source> and <target> configuration options of the maven-compiler-plugin, maybe followed by a Maven > Update Project to make sure m2e has sync’ed the changes to the pom.xml with the Eclipse buildpath.
I have downloaded and copied the http-builder-0.5.0-RC2.jar to the lib folder of my grails project. I am using GGTS and see the jar in my lib folder when I open the project.
BuildConfig.groovy has the following line in the dependency section:
compile 'org.codehaus.groovy.modules.http-builder:http-builder:0.5.0-RC2'
When I try to reference a class from the jar the I am getting a reference error indicating the class name cannot be resolved.
Is there something I am missing in regards to importing classes from a jar file? I am new to java / groovy and would appreciate some help. Thanks.
import groovyx.net.http.HTTPBuilder
This results in:
Groovy:unable to resolve class groovyx.net.http.HTTPBuilder
I have downloaded and copied the http-builder-0.5.0-RC2.jar to the lib folder of my grails project.
This should not be necessary, since HttpBuilder is in Maven Central. Just declare the dependency and let Grails download the JAR itself along with its transitive dependencies. You may also want to consider using a more recent version of HttpBuilder (0.5.0-RC2 is from 2009, at the time of writing the current release is 0.7.1).
Delete the JAR from your lib directory and try refreshing your Grails dependencies again.
I converted a Java project to maven project. But there are still maven dependencies not in the build path. There maven dependencies do not show up in the lib path.
Once you have converted your project to maven (i.e) you have to do the following in eclipse:
Right Click on your and select Maven --> Update Project
This will rebuild your eclipse and all dependencies that is defined in that project pom.xml will be added to your build path under Maven Dependencies.
In general all your dependencies will be downloaded to .m2 folder in your system. This will generally be inside your home directory unless you change it in the settings.xml.
Is there a way for me to add dependencies from other folders/projects(non-grails, but definitely java projects) into my grails project? I've tried searching but didn't really get much of an answer. :(
You can use every possible library which is in a maven repository. So transform your java project to a maven or gradle project. Install your builded jar to maven repo and then you can add dependency in grails-app/conf/BuildConfig.groovy.
dependencies {
compile "your.group:your.artifact:1.0"
}
You have to get the code into your project somehow.
These are the options:
JAR
Package your module as a jar file and copy this to your project's lib/ directory.
source code
Copy the source code for your module into src/java/
Maven Artifact
Package your module as a maven artifact, and specify it in the dependencies closure of grails-app/conf/BuildConfig.groovy.
Read more in the grails documentation at http://grails.org/doc/latest/guide/conf.html#configurationsAndDependencies
My project compiled fine without any problems. I went out of Eclipse and went back inside and get this error. These folders do not exist in my project. I do not think are part of Grails, it appears that the STS creates them. What is the problem?
STS 2.9, Grails 2.0.1
Thank you very much advanced
Right-click on the project node in the project tree and select Grails Tools | Refresh Dependencies. It will reconfigure the classpath and source folders based on the installed plugins.