Intellij IDEA Plugin for RAML - java

I have just started using RAML in my Java project. I am using Intellij IDEA and there my RAML file is displayed as raw text, without any text highlighting. It seems that it doesn't recognize this type of file at all.
Is there any plugin for RAML in Intellij IDEA?
Mostly I tried to google it and also checked in the list of plugins. If plugin doesn't exist, what would you suggest? It seems that then I would need to use some other tool to modify properly this file.

RESTful API Modeling Language (RAML) is a YAML-based language for describing RESTful APIs.
Intellij has a plugin for YAML syntax so you can use that for RAML.
Just go to settings -> Editor -> File Types.
Then under Recognized File Types just scroll down to YAML and select it.
Now just add *.raml and *.rml to the Registered Patterns section and you will get syntax highlighting.

There is a plugin Raml Intellij Plugin . It is still in beta but you can use it. You can download directly from the Intellij Repositories

The RAML Workbench for Atom is a good way to get started. It provides a lot of guidance to writing RAML.

The Raml plugin that I used to mantain is no longer under dev. To replace that I've added raml completion to the DataWeave Plugin. So if you install the Plugin It will also add Raml and Oas support. Saddly I needed to do this change. All these plugins are being mantain on my spare time

Related

Custom sonar-xml plugin highlighting conflict

I've developed a custom XML plugin for Sonar, based on a fork of official sonar-xml plugin following these recommendations.
When I develop the custom plugin the sonar-xml version was 1.5.1 and and both plugins work fine together in SonarQube 5.6.6.
Now I'm upgrading the SonarQube version to 7.9.1 and his plugins, but when the analysis is performed with sonar-xml-plugin v2.0.1 and my custom xml plugin based on sonar-xml-plugin v1.5.1 I get an error trying to save highlighting for XML files and an Issue in those files with issues detected by both plugins:
Parse error: Trying to save highlighting twice for the same file is not supported: samplefile.xml
Rule: XML parser failure (xml:S2260)
After seeing the javadoc of NewHighlighting class I came to the conclusion that it is a deliberate decision but I need to use both plugins and I would not want to leave them without updating because I also want to see the issues in SonarLint.
And not, rules based on XPath template of sonar-xml-plugin are not enough for my rules requirements.
Has anyone somewhere had the same problem? Some idea to solve the problem?
Thanks a lot in advance!

Static format checker for xml files using Maven

i'm using Maven as a build tool and Checkstyle to check that files conform to the agreed coding style.
The problem is that i also want to check formatting in XML files too, just simple indentation checks, but checkstyle doesn't support it.
I just can't find a tool that can do this simple checks and integrate with Maven.
Any ideas ?
A quick google search offers this:
https://www.mojohaus.org/xml-maven-plugin/check-format-mojo.html
Full name:
org.codehaus.mojo:xml-maven-plugin:1.0.2:check-format
Description:
An XML indentation check over a set of files.
Though I have not used it myself.

Is it possible to load an eclipse Java project using JDT in the headless mode?

I have an eclipse Java project and want to get information like project source dir, classpaths, etc. My current implementation parses the .project file. But as I didn't find any official documentation describing the structure of the .project file, I have some concerns for the robustness of this approach.
A more convenient and robust way would be to use JDT (headlessly) to load the project and get the relevant information from the IJavaProject object.
Although the developer guide of JDT says
JDT Core packages give you access to the Java model objects and headless Java IDE infrastructure.
all the examples I can find opening an existing Java project get the IJavaProject object from projects within a workspace or use an IProject object. But I couldn't find the way to add a project to the workspace or to construct a IProject/IJavaProject from a path to .project file.
Could anyone please help?
Yes, and can all be done through clear and stable API. org.eclipse.jdt.core is a plug-in, just like org.eclipse.core.resources (which is where you would get an IWorkspace instance), and they both expect to be running within an Eclipse runtime, which can be headless if that's how you write your Eclipse Application. JDT uses the .classpath file to record where sources, libraries, and build output are, and what abstracted references to libraries to use, while the .project file is what records what kind of project it is in general--Java, PHP, Web, some combination of those or others--and a little more information about what builders to execute.
So make yourself a headless Eclipse Application, or package your end-goal functionality inside of one.
https://wiki.eclipse.org/FAQ_What_is_an_Eclipse_application%3F
https://wiki.eclipse.org/FAQ_What_are_extensions_and_extension_points%3F
http://help.eclipse.org/mars/topic/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_core_runtime_applications.html?cp=2_1_1_27
http://help.eclipse.org/mars/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/core/resources/ResourcesPlugin.html#getWorkspace--
http://help.eclipse.org/mars/topic/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/JavaCore.html#getJavaCore--
http://help.eclipse.org/mars/topic/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/IJavaProject.html#getResolvedClasspath-boolean-
See http://www.ant4eclipse.org/ for a project which allows you to work inside Eclipse projects.
I used it for a bit some years back, and found that this is too brittle for long term usage and build scripts. I would recommend against relying on internal Eclipse things. They break! Typically when mixing releases.
Instead I would suggest you move to Maven. This is a bit more work, but allows you to use the whole maven infrastructure and API's to do things. What you want to achieve here, may be possible already using a Maven plugin.

netbeans find usages does not seem to scan xml files

Can anyone confirm this, or do I miss a check in a checkbox somewhere?
Example: When I go to a Java class and do a "Find Usages", it does not find a referance to the class, though it exists in a spring related xml-context file.
Can confirm this for Netbeans 7.2. And that's why some prefer Java spring config.
Try with this plugin: JohnBaker FindUsages, Spring Support for Find usages. Stock "find usages" from Netbeans doesn't support Spring.
There is also a generic Netbeans-Spring plugin.
Personally I use Eclipse with STS.

Tool for creating Dynamically Generated Code in Java (In Eclipse)

In Visual Studio land, I used to be able to define a structure in an XSD file and add a special attribute to it which would cause it to be dynamically compiled and available to use with intellisense in the other C# files in the application. I am not sure exactly what the term for this is, perhaps "dynamic code generation."
I am trying to accomplish the same in Java using Eclipse IDE. Basically what I am looking for is a tool that will allow me to specify some template and generate Java code from it in a "hot folder" that will allow me code complete in the other static Java files.
Does anyone know of a solution for this? I know it is possible in Visual Studio, but I can't seem to find anything for Eclipse.
Ok, here is exactly what I want to do.
Step 1. I create a folder called templates
Step 2. I create a file called HelloWord.ibes
Step 3. Code it automatically generated in my src folder HelloWorld.java
I want to be able to do this in eclipse easily.
You may create an ant build file that does the source generation for you. Then you are free to use any code generator you like. Ant support is part of the eclipse IDE. If you prefer maven, there's a nice eclipse pluging available (that's what I actually use for source code generation based on jaxb, javacc and xdoclet...).
Technically spoken, you just add another eclipse builder which is invoked anytime eclipse detects a change in your code base.
If you already have a code generator in mind, just 'ask' the internet if there's a plugin available.
Edit
On how to install a builder: This is done automatically. For maven, you just install the maven plugin (m2eclipse) and enable maven dependencies for a project. Then if you look at the projects properties pages (Builder section), you find a second entry in the list of builders.
It's similiar with ant, even easier, because ant is already integrated. "enable" ant for a project and the builder is added to the list of builders for the project. You can deselect it at any time if it kills performance or switch of automatic building (I don't know by heart how to enable ant builds for a project, but I remember that the eclipse help had sufficiant informations).
All about ant can be found here: Apache Ant
Creating a new builder is difficult, as it has to be coded in java and added to eclipse as a plugin. I bet you don't want to follow that track ;)
I'm not sure whether you have seen the code template option?
Preferences.Java, Code Style then Code Templates
How
to add code templates
Useful
code templates

Categories

Resources