Sonarlint-core hook points for new grammar - sonarqube

I am doing a POC where I am trying to write grammar/creating a new analyser.
I am able to run the grammar using the sonar-qube and sonar-scanner.
Now,I need to integrate the same with sonar-lint eclipse plugin.
I have git copied the sonarlint-eclipse code and found that it is internally using sonarlint core to load the jars of different grammars like Java,Javascript using helper classes like PluginRepository.
I have found that at below path C:\Users\xyzUser\runtime-EclipseApplication\.sonarlint\storage\localhost\global, "plugin_references.pb" file contains the key,hash and jar name.
Can somebody please explain the exact hook points to introduce new grammar jar for sonar-lint eclipse plugin?
I am trying to run it in both Standalone mode and Connected Mode.

You're not going to be able to run your new grammar in SonarLint; it maintains a whitelist of plugins it will run. Inevitably, yours is not on it.

Related

Maven archetype post generation script passwort input obfuscate

I have created my own archetype. This archetype contains also a post generation script (groovy) which needs user credentials as parameter. Unfortunatly maven doesn't support obfuscated input in the interactive mode. So i was trying to read inputs via the groovy scripts, described as well at https://code-maven.com/groovy-read-from-stdin. Unfortunatly the console object isn't availabel and i can't use following:
System.console().readPassword()
Do you have any other idea how to achive a obfuscated input in maven or groovy script (without using console)
Maybe i have to create a seperated script which is doing to post generation stuff. But i would like to be OS independent. I don't want to introduce another technology stack to be installed like python etc...

XrmToolBox PluginRegistration. Edit Plugin Step Configuration from plugin code

How can I modify the Unsecure and Secure Configuration in plugin code for step?
For example, I have a plugin and I will send it to my friend. I want this plugin to clean or modify all information that my friend has in his XrmToolBox Plugin Step Secure Configuration field and add mine (for me is necessary to add mine config in this field). Can I do it from code in my plugin?
Let's make the things straight.
CRM Plugin is an executable code logic for extending the platform execution pipeline like do something (ex. Assign/Update) after something (ex. Create/Update) happens.
Plugin registration tool (PRT) is useful for registering the Plugin assembly (dll) & steps to execute per our expectation.
Secure/Unsecure config for Plugin step is just like web.config in our web application. Read more
You want to configure certain key/value pair, for example - some external web service credentials, then put it in secure config of that particular plugin step using PRT, so that you can consume it inside the plugin step code logic.
We will not update the secure config from the plugin code, rather we will just consume it.
If you are shipping your environment plugin steps to your friend environment, then give the plugin assembly & step as a solution package, once the solution is imported in your friend environment - the XrmToolBox PRT will show the changes. Or connect the two environments in different PRT sessions & verify the differences for config merge process.
If you want to develop a console app or something to do the deployment for you, read the below link:
Programatically Updating the Secure Configuration of a Plug-in Step

create different types of job in jenkins

How can I create different types of Jenkins projects like Maven, Multi configuration etc. and configures them using groovy script that can be run on Jenkins script console? or is there any Jenkins-cli command available in order to achieve this.
In case you know any other approach apart from this please let me know. Thanks in advance.
First - You need the appropriate plugins for the different job types (like the Maven plugin).
If you'll read a bit about the CLI (JenkinsMaster:port/cli/) you can see that you have many actions you can do. One of them is to create a job:
java -jar jenkins-cli.jar -s http://JenkinsMaster:Port/ create-job NAME
You will need to define a job configuration file (a simple xml file) to add using the CLI.
I would suggest creating a Maven job for example, go to your $JENKINS_HOME/jobs folder and see how the xml file is written to better understand what it is you need to do.
And I would also suggest to try and read about Jenkins and how jobs are configured and work. I will add links to great tutorials if needed - comment if you intend to learn and interested.

A good strategy for knowing the versions of deployed applications?

In order to know which revision number the application is built from, we use to give the ears we deploy to Glassfish names like myapp_2012-01-20_rev22123.ear. Then we can simply login to Glassfish and see what version is deployed in the web interface (as the appname is the name of the ear file). A downside of this approach is that we need to do a manual undeploy/redeploy to update the name...
But I would like to script the undeploy/deploy process, and having each version of an ear get a different name is not very suitable to scripting this redeployment process. Glassfish 2 does not support the "list applications" goal that Glassfish 3 has, which I could have used to retrieve the application name to undeploy.
So is there any good strategy that will easily allow us to see what version is deployed of an application, and that does not suffer from the above fault?
It would be preferable if this meant we did not have to change the existing applications (like add a jsp page or something to show the current scm revision), but a change in a Maven build script would be acceptable.
I faced a similar issue, I finally came around it by using maven-buildnumber-plugin and writing a simple servlet to get build information. You can find the details in the blog post I made.
Why not use the built-in GlassFish Server versioning to assign a version number at deploy time? This will also enable you to rollback to prior versions. For example:
asadmin deploy --name MyApplication:2012-01-20_rev22123 MyApplication.ear
There is more information on application versioning here:
http://docs.oracle.com/cd/E18930_01/html/821-2417/gihzx.html#gkhhv
Hope this helps.

How to deal with database initialization?

As also described here, I'm trying to determine the best way to initialize and update my application's database. I use EclipseLink-JPA2. I distribute a NetBeans platform application.
Considered options:
use create-tables ddl-generation:
The problem with this is that everytime the application runs it will throw exceptions, failing to create the tables. It will be useful only at setup time. This would be similar to placing checking code in the module restored() method.
include the database with the application distribution: the ddl-generation strategy becomes do nothing. I could still use the JPA (at development time) to generate the database files (embedded Java DB).
The best solution would be for the installer/setup (first-time) to call initializing code that creates the database. This precisely what I do with JWS in here. But I don't know how to do that without JWS. A script/jar executed by the installer?
Distribute your NetBeans Platform application via JWS.
It seems like you already have this problem sorted out with JWS, so just use that solution to deploy your NetBeans platform app.
EDIT
An alternative approach would be to use a Module Installer that checks for the existence of a config file. If the file exists then the application has been run before and the setup is not required. If the file doesn't exist then run your setup steps.
Have a look at this tutorial, they're using a module installer to create a login dialog.

Resources