Is it possible to import/add eclipse code formatter .xml in SonarQube? - eclipse

The code below is a sample of what eclipse code format I want to use.
<profiles version="11">
<profile kind="CodeFormatterProfile" name="equationStyle" version="11">
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
.
.
.
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
</profile>
</profiles>
Is it possible to import/add this to SonarQube?

No this is not possible.This request partially relates to http://jira.codehaus.org/browse/SONARIDE-112

Related

Specifying default theme in Eclipse product doesn't work

I'm trying to create an Eclipse 4.8 application and defining the theme with the org.eclipse.core.runtime.products extension point.
I'd like to have the dark theme that bundled with org.eclipse.ui.theme_1.2.100 be the default.
I see this in the plugin XML:
<stylesheet
uri="css/dark/e4-dark_preferencestyle.css">
<themeid
refid="org.eclipse.e4.ui.css.theme.e4_dark"></themeid>
</stylesheet>
I'm specifying my product like this:
<plugin>
<extension id="ide" point="org.eclipse.core.runtime.products">
<product application="org.eclipse.ui.ide.workbench" name="%productName" description="%productName">
<property name="introTitle" value="%introTitle" />
<property name="applicationCSSResources" value="platform:/plugin/org.eclipse.platform/images/" />
<property name="applicationXMI" value="org.eclipse.platform/LegacyIDE.e4xmi" />
<property name="cssTheme" value="org.eclipse.e4.ui.css.theme.e4_dark" />
<property name="preferenceCustomization" value="plugin_customization.ini" />
</product>
</extension>
</plugin>
But when I build and launch the application, it seems to still be the default light theme. Am I defining the css properly?

Config transformation special situation

I have the following config file
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<settings>
<setting name="Demo" value="true"/>
<setting name="Demo2" value="true"/>
</settings>
</sitecore>
</configuration>
And I want it transformed into this
<configuration xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore role:require="Standalone OR ContentDelivery OR ContentManagement">
<settings>
<setting name="Demo" value="false"/>
<setting name="Demo2" value="true"/>
</settings>
</sitecore>
</configuration>
I have tried to use this https://fatantelopetester.apphb.com/ and obtained the following transformation config file:
<?xml version="1.0" encoding="utf-16"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xdt:Transform="SetAttributes(xmlns:role,xmlns:set)" xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<sitecore role:require="Standalone OR ContentDelivery OR ContentManagement" xdt:Transform="SetAttributes(role:require)">
<settings>
<setting name="Demo" xdt:Locator="Match(name)" value="false" xdt:Transform="SetAttributes(value)" />
</settings>
</sitecore>
</configuration>
But apparently this transformation is not good enough and not working.
Any ideas how to make it work, in conditions when under
<sitecore>
I have lots of other setting? (Here I've added just a sample)
I just ran into a similar issue myself and found a solution that worked for me. I'm not using SlowCheetah but I am using a tool that uses XDT under the hood.
The XDT would fail around xdt:Transform="SetAttributes(role:require)" because the namespace wasn't found. However, using xdt:Transform="SetAttributes" didn't seem to have the same problem and was able to set the attribute just fine.

Use the eclipse hibernate tool with hibernate spatial library

There is some one that was able to configure the HQL tool of the eclipse hibernate tool? I have try to configure it using the JPA. My configuration generate all the Entity (that are observable in the configuration) and the connection to the database but the session factory return the following
Could not determine type for: org.hibernate.spatial.GeometryType, at table:....
There is a way to solve this problem, maybe adding some library or configuration?
I am using Postgis DB and the proprietis of the configuration are:
<properties>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.hbm2ddl.auto" value="off" />
<property name="hibernate.dialect" value="org.hibernate.spatial.dialect.postgis.PostgisDialect" />
</properties>

different log4j.xml when exporting jar from eclipse

I have problem when export to executable jar.
I'm using maven and slf4j with log4j
My pom.xml
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.2</version>
<scope>runtime</scope>
</dependency>
I added a log4j.xml in /src/java/main (is the same that in generated target folder):
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
<appender name="FILE" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="/media/dlm/log/dlm.log" />
<param name="Threshold" value="INFO" />
<param name="Append" value="false" />
<param name="MaxFileSize" value="10MB" />
<param name="MaxBackupIndex" value="1" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}:%L] %m %n" />
</layout>
</appender>
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<param name="Threshold" value="INFO" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{ABSOLUTE} %-5p [%c{1}:%L] %m %n" />
</layout>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="FILE" />
</root>
</log4j:configuration>
But when I export from eclipse the log4j.xml is changed for the next one:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
<appender name="FILE" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="/tmp/dlm/log4j.log" />
<param name="Threshold" value="INFO" />
<param name="Append" value="false" />
<param name="MaxFileSize" value="1MB" />
<param name="MaxBackupIndex" value="1" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %X{service} %X{user} [%c] %m%n" />
</layout>
</appender>
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<param name="Threshold" value="ERROR" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{ABSOLUTE} %-5p %X{service} %X{user} [%c{1}] %m%n" />
</layout>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="CONSOLE" />
</root>
</log4j:configuration>
I tried using log4j.properties file as appear here, but nothing.
Thanks in advance your answers.
Thanks to Peter I understood that when run an aplicacition with eclipse I was using eclipse options and not maven itself to build my app. That was the reason log4j.xml probably change. The next solution not resolve why it happens, but resolve the problem and give me a correct way to build my app using 100% maven.
I just need to add some new fields to my pom.xml to make things that eclipse options probably add automatically.
1.-Include xml files:
<build>
...
<!-- RECURSOS -->
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.fxml</include>
<include>log4j.xml</include>
</includes>
</resource>
</resources>
...
</build>
2.- Executable jar (I have 3 different main classes in same project):
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>${class.main}</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
3.- Add profiles to select main class:
<profiles>
<!-- DLM ANALOG -->
<profile>
<id>dlmdesktopanalog</id>
<properties>
<class.main>cl.icpdas.dlm.desktop.fx.main.analog.DataLoggerAnalogManager</class.main>
</properties>
</profile>
<!-- DLM DIGITAL -->
<profile>
<id>dlmdesktopdigital</id>
<properties>
<class.main>cl.icpdas.dlm.desktop.fx.main.digital.DataLoggerDigitalManager</class.main>
</properties>
</profile>
<!-- DLM EXTRACTOR -->
<profile>
<id>dlmdesktopextractor</id>
<properties>
<class.main>cl.icpdas.dlm.desktop.fx.main.extractor.DataLoggerExtractorManager</class.main>
</properties>
</profile>
</profiles>
Finally, I used the next goals make my executable jar.
mvn clean package assembly:single -e -P dlmdesktopanalog
Anyway, if someone knows where eclipse set log4j.xml and other options when make a exejutable jar or what is reasson why it changes log4j.xml the answers are wellcome as comment.

How to combine 3 steps in ant build.xml into one step for Netbeans to generate a signed jar to run in web start?

My web start app ran fine, but I realized there is a lib dir I need to copy into the tomcat ROOT dir in order for my web start app to work, but I want to just combine all my jars into one big jar so I just need to copy one file each time I update the project. I searched on the web and found a solution to combine all jars into one, with the following step, which was mentioned at : http://arunasujith.blogspot.com/2011/08/how-to-build-fat-jar-using-netbeans.html
I rewrote my build.xml to look like this :
<project name="Test_Tool" default="default" basedir=".">
<description>Builds, tests, and runs the project Test_Tool.</description>
<import file="nbproject/build-impl.xml"/>
<target name="package-into-one-jar" depends="jar">
<property name="store.jar.name" value="Test_Tool"/>
<!-- don't edit below this line -->
<property name="store.dir" value="dist"/>
<property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/>
<echo message="Packaging ${application.title} into a single JAR at ${store.jar}"/>
<jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip">
<zipgroupfileset dir="dist" includes="*.jar"/>
<zipgroupfileset dir="dist/lib" includes="*.jar"/>
<manifest><attribute name="Main-Class" value="${main.class}"/></manifest>
</jar>
<zip destfile="${store.jar}"><zipfileset src="${store.dir}/temp_final.jar" excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/></zip>
<delete file="${store.dir}/temp_final.jar"/>
<delete dir="${store.dir}/lib"/>
</target>
</project>
But when I ran it, it said there are some files unsigned, and can't run from html page, so I did some more search and found a way to sign the jar file, which is mentioned at : http://www.asjava.com/ant/how-do-i-sign-jar-files-in-ant/
So I've come up with an script [ sign_jar.xml ] look like this :
<?xml version="1.0"?>
<project name="ant to create keystore and sign jars" default="signjars" basedir=".">
<tstamp/>
<property name="build.output.dir" value="C:/Dir_Test_Tool/dist"/>
<property name="build.classes.dir" value="C:/Dir_Test_Tool/dist"/>
<property name="verisign.key.store" value="${build.output.dir}/.keystore"/>
<property name="verisign.key.storepass" value="asjava.com"/>
<property name="verisign.key.alias" value="asjava"/>
<property name="verisign.key.pass" value="asjava.com"/>
<target name="signjars">
<mkdir dir="${build.output.dir}"/>
<genkey alias="${verisign.key.alias}" verbose="true" storepass="${verisign.key.storepass}"
keypass="${verisign.key.pass}" validity="365" keystore="${verisign.key.store}">
<dname>
<param name="CN" value="AsJava.com Group"/>
<param name="OU" value="Jim"/>
<param name="O" value="AsJava.com"/>
<param name="C" value="US"/>
</dname>
</genkey>
<signjar jar="${build.classes.dir}/Test_Tool.jar"
signedjar="${build.output.dir}/Test_Tool.jar"
alias="${verisign.key.alias}"
storepass="${verisign.key.storepass}"
keystore="${verisign.key.store}"
keypass="${verisign.key.pass}"/>
</target>
</project>
After all the changes, I needed to do the following to get the signed big jar file :
<1> Build my project in Netbeans
<2> In files view of the project right click build.xml file and then select Runtarget >> Other Targets >> package-into-one-jar
<3> In files view of the project right click sign_jar.xml file and then select Runtarget >> signjars
Now it works as I wished : One big jar that is signed.
But that's 3 steps in order to achieve this, there must be an easier way, why can't it be done in one step ? So I combined the above files into one, which looked like this :
<?xml version="1.0" encoding="UTF-8"?>
<project name="Test_Tool" default="default" basedir=".">
<description>Builds, tests, and runs the project Test_Tool.</description>
<import file="nbproject/build-impl.xml"/>
<target name="package-into-one-jar" depends="jar">
<property name="store.jar.name" value="Test_Tool"/>
<property name="store.dir" value="dist"/>
<property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/>
<echo message="Packaging ${application.title} into a single JAR at ${store.jar}"/>
<jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip">
<zipgroupfileset dir="dist" includes="*.jar"/>
<zipgroupfileset dir="dist/lib" includes="*.jar"/>
<manifest><attribute name="Main-Class" value="${main.class}"/></manifest>
</jar>
<zip destfile="${store.jar}"><zipfileset src="${store.dir}/temp_final.jar" excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/></zip>
<delete file="${store.dir}/temp_final.jar"/>
<delete dir="${store.dir}/lib"/>
</target>
<property name="build.output.dir" value="c:/asjava"/>
<property name="build.classes.dir" value="C:/Dir_Test_Tool/dist"/>
<property name="verisign.key.store" value="${build.output.dir}/.keystore"/>
<property name="verisign.key.storepass" value="asjava.com"/>
<property name="verisign.key.alias" value="asjava"/>
<property name="verisign.key.pass" value="asjava.com"/>
<target name="signjars">
<mkdir dir="${build.output.dir}"/>
<genkey alias="${verisign.key.alias}" verbose="true" storepass="${verisign.key.storepass}"
keypass="${verisign.key.pass}" validity="365" keystore="${verisign.key.store}">
<dname>
<param name="CN" value="AsJava.com Group"/>
<param name="OU" value="Jim"/>
<param name="O" value="AsJava.com"/>
<param name="C" value="US"/>
</dname>
</genkey>
<signjar jar="${build.classes.dir}/Test_Tool.jar"
signedjar="${build.output.dir}/Test_Tool.jar"
alias="${verisign.key.alias}"
storepass="${verisign.key.storepass}"
keystore="${verisign.key.store}"
keypass="${verisign.key.pass}"/>
</target>
</project>
But the strange thing is : now it copies all the compiled directories under src into dist, if I delete them the result big jar won't run, I don't know ant good enough to correctly combine the above 3 steps into one, and don't know Netbeans enough to solve this problem, can someone help ?