Grails dependencies 'empty' in java build path STS - eclipse

My coworker is attempting to install STS, groovy/grails onto his PC. He has imported a TFS project which grabbed the source fine. However he is getting lots of build errors that appear to be the result of the Grails Dependencies library being empty. He cleared .ivy2 cache and restarted STS which repopulated the .ivy2 cache. However, the dependencies are still empty under the build path (right click project, build path, libraries tab, expand Grails Dependencies).
He might be able to add them manually, but that doesn't seem like the appropriate solution and may cause issues down the line. Any ideas?

Select "Grails Tools -> Refresh dependencies" from the context menu of your project. Then the dependencies are added.

I had the same problem. It turned out that an undeclared class was causing the problem. One of the STS engineers responded that "if the command "grails compile" fails, then STS will not have the dependency data. This data is produced as a side effect of the compile command. So it doesn't get generated if the compile fails."
Basically, the entire Grails Dependency issue was a red herring. If you look at the Error Log (Window->View->Error Log or Window->View->Other: General->Error Log) check to see there is an undefined that is stopping the grails compile.

Related

Problems in Netbeans when switching from Ant to Maven

After passing a complex Codename One project from Ant to Maven with the appropriate tool (https://www.codenameone.com/blog/migrating-your-project-to-maven.html), in Netbeans 12.3 I have two problems:
when in the log there is the stack trace of a crash, clicking on the line of code (reported in the log) does not open the related Java file and automatically scroll to the line in question (with Ant it worked).
Netbeans reports me non-existent errors, even if it compiles correctly: these errors are all related to code that refers to libraries (before, with Ant, these errors were not reported).
Thanks for the suggestions
I have good news, I solved both issues.
About the fake errors like in the screenshot, right-clicking on the "common" module of the Codename One project, there was an item "Resolve Project Problems" that I hadn't noticed before. The error was:
Your project has dependencies that are not resolved locally. Code
completion in the IDE will not include classes from these dependencies
or their transitive dependencies (unless they are among the open
projects). Please download the dependencies, or install them manually,
if not available remotely.
The artifacts are:
xxx:mainclass-cn1-websockets:jar:common:1.0-SNAPSHOT
xxx:mainclass-Device:jar:common:1.0-SNAPSHOT
xxx:mainclass-NativeLogsReader:jar:common:1.0-SNAPSHOT
xxx:mainclass-SMSActivation:jar:common:1.0-SNAPSHOT
xxx:mainclass-GoogleMaps:jar:common:1.0-SNAPSHOT
xxx:mainclass-CameraKitCodenameOne:jar:common:1.0-SNAPSHOT
xxx:mainclass-VideoOptimizerCN1Lib:jar:common:1.0-SNAPSHOT
As you can see, all the errors refer to cn1libs. By clicking on "Resolve", Netbeans automatically resolved this issue and the false errors (like the one in the screenshot) disappeared.
This partially solved also the first problem, related to the fact that Netbeans did not open the java file related to the error line reported in the log. I specified "partially solved" because the problem is solved only by taking care, before pressing "Run", to left-click in the Projects view on the main module of the application (otherwise the "Run" will refer to the "common" module, with various side effects). Ultimately, however, without the use of "Resolve Project Problems" this partial solution would not have worked. I'm sure of this because I ran some tests on the exact same error before and after.
UPDATE
Removing nbactions.xml from the common package prevents the use of "Run" with that package, avoiding the described problem.

Grails asset-pipeline Shows wrong Build Path in Eclipse

My problem is resolved but I don't understand why it wasn't working.
Using: Grails 2.4.2, Groovy 2.3.7, Java 1.7, Eclipse- Indigo
I set my project up, and in the assets folder under grails-app I placed my static assets. I was also using twitter-bootstrap. The project would run, but nothing would be displayed from the assets folder. I did a Grails clean and got build path errors. in Eclipse right clicking the project name and going to Java Build Path and under the source tab there were links such as:
projectName/.link_to_grails_plugins/cache-1.1.7/src/java
or
projectName/.link_to_grails_plugin/asset-pipeline-1.8.11/grails-app/controllers etc
I deleted my target directory, and deleted all the links that were errors inside the Source tab. I restarted eclipse and refreshed, and voila it worked. The links came back, looked exactly the same but were now good apparently. I'm just not 100% sure why it worked though. The assets were in the right place, and never moved. Why did this work?
Eclipse doesn't parse BuildConfig.groovy or infer paths or dependencies - it gets all of that from Grails. You can force it to reconfigure the classpath by right-clicking on the project node in the tree on the left and selecting Grails Tools | Refresh Dependencies. That will cause Eclipse to run grails compile --non-interactive --refresh-dependencies and it gets classpath information from that.
When you restarted it must have determined that enough had been deleted that it needed to refresh itself, or it might just do that each time you restart.

Why is Eclipse (Kepler) attempting to run this Weblogic class when saving my HTML?

Every time I make a change to some HTML I am editing, this error
comes up:
Errors occurred during the build.
Errors running builder 'Faceted Project Validation Builder' on project 'CateredToYou'.
Could not initialize class oracle.eclipse.tools.weblogic.server.WebLogicServerRuntimeComponentType
I'd like to figure out why the error comes up despite the fact that I am not doing any J2EE development at the moment
OR
how can I shut off whatever is trying to execute this command.
This sounds like a builder that is configured on the project is having problems.
Open the Properties for the project and look in Builders. You will see a list of the builders configured for the project which should include 'Faceted Project Validation Builder'. You can disable it by clearing the check box or remove it entirely.
I accidentally deleted the Java 1.6 needed for Eclipse when I allowed the Java auto update.
As it turns out, the jdk1.6 was not deleted from the system but it was not in the "Installed JRE's" list
I added the JRE, but was still getting the error. I added the jdk to the config and the error went away.

Can anyone help me fix this m2e-jdt/jdt bug?

Introduction
I have spend a lot of time to fix this bug
In our application we have a lot of generated code by cxf and jaxb which produces tons of warnings. We use the maven-build-helper plugin to add this code to our projects automatically.
By adding this enhancement, eclipse JDT enabled the possibility to set the javac -nowarn flag for specific source folders. Unluckily, by updating the maven project the flag gets lost. There are a few threads on SO where users got bugged by bug.
What I have tried so far
So i came up with a clever solution, javac has a nowarn flag. I set it to my maven-compiler-plugin and specified the directory. My maven build was fine, but my eclipse build wasn't. My research told me, that eclipse jdt does only use the maven-compiler-plugin source and target version. So my next step was to try to configure the EclipseCompiler, but this is not possible, because there is no possibility to add custom compiler Arguments in eclipse JDT.
Next Step. Inside of the .classpath file, eclipse JDT adds an ignore_optional_problems attribute for each ignored path. By updating the maven project inside of eclipse, this entry gets lost. So i started to write a maven "ignore-source-folder" plugin which should add the missing attribute. To run the plugin each time eclipse starts a build, i also created a m2e connector to refresh the .classpath file and everything should be fine.
By testing my plugin with my connector i realized, it works, but only 70% of the repetitions.
What happened?
Every time eclipse m2e/Jdt starts a new build, all classpath entries will be removed and populated again. When my maven plugin gets triggered by eclipse, a race condition starts.
So I started to analyze the code of jdt and m2e jdt. The ignore_optional_problems flag gets only once set manually inside of the patch which was provided to JDT and isn't stored somewhere else. By triggering a new build via m2e-jdt this information gets lost.
How to fix this problem
To fix this problem, some element has to be added or extended in jdt which contains all ignored folders. If a new build gets triggered and the classpath file gets newly generated by m2e-jdt this element should be checked for ignored paths. ClasspathEntryDescriptor seems to be a good place for it.
My problem
I checked out jdt and m2e jdt, but i have tons of errors inside of my IDE and i have no idea how to start. And even if I fix the code, I have no idea how to build and test it. I think my effort will be to high and we talk about 20 or 30 simple lines of code.
I am afraid if I add my results to the filed bug at eclipse, no one will care about it.
So, is there any developer able and willing to help me for this tiny job?
You need to "fix" the M2E's JDT project configurator. Probably somewhere in the m2e-core project. So, your change should obtain some kind of configuration flag from the project pom and create corresponding classpath entries for JDT.

Push-in refactor of a roo generated controller raises "No crosscutting model available. Rebuild project"

This project compiles without error and runs fine. I have run "Project..Clean" on it, as well as "Maven..Update project" and "mvn clean install". After each of these steps, I still get the same refactoring error.
I also selected "Spring tools..Enable Spring Aspects tooling" just for kicks.
I also tried disabling and re-enabling JDT Weaving, and also tried the "Index Now" option.
What am I missing to be able to refactor the roo controller?
STS Version: 3.1.0.RELEASE
aspectjrt-1.7.0.RC1
aspectjweaver-1.7.0.RC1
I switched the maven configuration to use the embedded version instead of the external command, and a rebuild allows be to refactor now. I discovered by using the external maven, the crosscutting model is not built in the Eclipse environment.
Background: Due to an previous problem with maven, it was suggested to use the external version, which resolved THAT problem of not being able to be compiled inside of Eclipse. Apparently that issue is gone, as the project now builds with the embedded maven.
Some hints to resolve the problem:
right click > disable maven nature, then go to the system directory of your project, do an mvn eclipse:clean, return to eclipse, right click, configure > convert to maven project.
verify if you have project > build automatically is checked.
do a project > clean, maybe this is the final step you missed.