getting error in sonar task while executing build.xml - sonarqube

I have configured sonar in my build xml as shown below but upon execution of my build.xml i am getting the error below..can u plas advise how to overcome from this error
target name="sonar">
<echo message="**** thirdparty.lib.dir -- > ${thirdparty.lib.dir}/sonar ****"/>
<sonar:sonar workDir="${build.dir}" key="gtr_61.all.rules:dev" version="1.0" xmlns:sonar="antlib:org.sonar.ant">
<!-- source directories (required) -->
<sources>
<path location="${pps.dir}/src" />
<path location="${pn.dir}/src" />
</sources>
<property key="sonar.host.url" value="https://abc/" />
<property key="sonar.jdbc.url" value="jdbc:oracle:thin:abc" />
<property key="sonar.jdbc.driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property key="sonar.jdbc.username" value="=AAA" />
<property key="sonar.jdbc.password" value="BBB" />
<property name="sonar.scm.url" value="https://svn.ats" />
<property name="sonar.java.source" value="1.5" />
<property name="sonar.language" value="java"/>
<property name="sonar.projectVersion" value="1.0"/>
<tstamp prefix="build-info">
<format property="current-date" pattern="dd-MMM-yyyy" locale="en" />
<format property="current-time" pattern="HH:mm:ss z" locale="en" />
<format property="year-month-day" pattern="yyyy-MM-dd" locale="en" />
</tstamp>
<!-- cobertura -->
<property key="sonar.cobertura.reportPath" value="cobertura-report/coverage.xml" />
<property key="sonar.dynamicAnalysis" value="reuseReports" />
<!-- binaries directories, which contain for example the compiled Java bytecode (optional) -->
<binaries>
<path location="${ps.dir}/build/classes" />
<path location="${omm.dir}/build/classes" />
</binaries>
<!-- path to libraries (optional). These libraries are for example used by the Java Findbugs plugin -->
<libraries>
<path location="${lib.dir}" />
</libraries>
<property key="sonar.profile" value="abc Rule" />
<!--property key="sonar.profile" value="Custom Rules" -->
</sonar:sonar>
the error i am getting is ..
onar
[06:56:15]echo
[06:56:15]**** thirdparty.lib.dir -- > /opt/app//buildAgent-8.0.3/work/pla/lib/thirdparty/sonar ****
[06:56:15]sonar:sonar
[06:56:15]property doesn't support the "name" attribute

If my feeling is correct you're using a very old version of the SonarQube Ant task. Here is the way to configure this SonarQube Ant task: http://docs.codehaus.org/display/SONAR/Analyzing+with+SonarQube+Ant+Task

Here is a latest documentation on the new syntax:
http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Ant+Task

Related

converting Ant to gradle regex expression task

//How to Write below code in gradle
converting from ant to gradle
<property name="abc" value="path/to/abc/file"/>
<property name="pqr" value="path/to/pqr/file"/>
<property name="xyz" value="path/to/xyz/file"/>
<var name="myfiltersetTokens" value="abc,pqr,xyz"/>
<for list="${myfiltersetTokens}" param="prop" >
<sequential>
<propertyregex property="#{prop}" input="${#{prop}}" override ="yes" regexp="^[ \s]+|[ \s]+$" replace="" global="true" />
</sequential>
</for>
If you want to copy & transform you can use Copy.filter
Eg:
task copyAndTransform(type: Copy) {
from 'path/to/abc/file'
from 'path/to/pqr/file'
from 'path/to/xyz/file'
into 'someDir'
filter { it.replaceAll('^[ \s]+|[ \s]+$', '') }
}

Cordova Plugin add folder to root of project

Making a custom cordova plugin, I need to add the sdk files to the root level of the xcode project, but it always ends up in the plugins folder of the xcode project
how do I add the folders (XIBs and MiSnap_Res) to the root of the project so they are a gold colored folder, not blue, or at least on the project level, outside the plugins folder
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="com.keybank.MiSnapPlugin"
version="0.0.1">
<name>MiSnapPlugin</name>
<description>MiSnapPlugin Custom Plugin Made by Derek Hannah</description>
<author>Derek Hannah</author>
<license>Apache 2.0 License</license>
<engines>
<engine name="cordova" version=">=3.5.0" />
</engines>
<js-module src="www/MiSnapPlugin.js" name="MiSnapPlugin">
<clobbers target="MiSnapPlugin" />
</js-module>
<platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="MiSnapPlugin">
<param name="ios-package" value="MiSnapPlugin" />
</feature>
</config-file>
<framework src="libstdc++.6.tbd" />
<framework src="AudioToolbox.framework" />
<framework src="AVFoundation.framework" />
<framework src="CoreGraphics.framework" />
<framework src="CoreMedia.framework" />
<framework src="CoreVideo.framework" />
<framework src="MobileCoreServices.framework" />
<framework src="QuartzCore.framework" />
<framework src="OpenGLES.framework" />
<framework src="Security.framework" />
<framework src="ImageIO.framework" />
<framework src="Foundation.framework" />
<framework src="Foundation.framework" />
<framework src="UIKit.framework" />
<source-file src="src/ios/libMiSnap.a" framework="true" />
<resource-file src="src/ios/MiSnap_Res"/>
<source-file src="src/ios/XIBs" target-dir="../.."/>
<header-file src="src/ios/include/MiSnap.h" />
<header-file src="src/ios/MiSnapPlugin.h" />
<source-file src="src/ios/MiSnapPlugin.m" />
</platform>
<!--<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="HelloWorldPlugin">
<param name="android-package" value="mobi.monaca.HelloWorldPlugin"/>
</feature>
</config-file>
<source-file src="src/android/mobi/monaca/HelloWorldPlugin.java" target-dir="src/mobi/monaca" />
</platform>-->
</plugin>

Dynamic URL for Custom Http-Client - Spring-XD

We have written a custom Http-client for spring XD and planning to use this custom processor for invoking different APIs. However, We have a situation where we need to invoke two different API based on the payload. Apart from using dynamic-router (which writes to a named channel) is there a way we can set the URL dynamically for the http-client to invoke? Here is the current configuration.
<header-filter input-channel="input" output-channel="inputX"
header-names="x-death" />
<service-activator input-channel="inputX" ref="gw" />
<gateway id="gw" default-request-channel="toHttp"
default-reply-timeout="0" error-channel="errors" />
<beans:bean id="inputfields"
class="com.batch.httpclient.HTTPInputProperties">
<beans:property name="nonRetryErrorCodes" value="${nonRetryErrorCodes}" />
</beans:bean>
<beans:bean id="responseInterceptor"
class="com.batch.httpclient.ResponseInterceptor">
<beans:property name="inputProperties" ref="inputfields" />
</beans:bean>
<chain input-channel="errors" output-channel="output">
<transformer ref="responseInterceptor" />
</chain>
<int-http:outbound-gateway id='batch-http'
header-mapper="headerMapper" request-channel='toHttp' url-expression="${url}"
http-method="${httpMethod}" expected-response-type='java.lang.String'
charset='${charset}' reply-timeout='${replyTimeout}' reply-channel='output'>
</int-http:outbound-gateway>
<beans:bean id="headerMapper"
class="org.springframework.integration.http.support.DefaultHttpHeaderMapper"
factory-method="outboundMapper">
<beans:property name="outboundHeaderNames" value="*" />
<beans:property name="userDefinedHeaderPrefix" value="" />
</beans:bean>
<channel id="output" />
<channel id="input" />
<channel id="inputX" />
<channel id="toHttp" />
If it's based on the payload type, something like this should work...
url-expression="payload.getClass().getSimpleName().equals("Bar") ? 'http://foo/bar' : 'http://foo/baz'"
If it's a property on the payload, then
url-expression="payload.foo.equals("bar") ? 'http://foo/bar' : 'http://foo/baz'"
EDIT
or
url-expression="payload.foo.equals("bar") ? '${url1}' : '${url2}'"
This would need changing the property metadata class to rename url and add url2.

Enunciate framework - Not working with Spring Restful project

I have integrated enunciate framework to generate the API document for the Spring RESTful project. I have followed the steps from https://github.com/stoicflame/enunciate/wiki/Executables and deployed the war created from the enunciate configuration in the tomcat server(http://localhost:8080/sample_enunciate) but its displaying the empty document. Here I have provided the configuration details used in the sample project.
NOTE: But the similar configuration is working with Jersey restful project. I really stuck here. Please let me know, is this bug with the enunciate framework integration with Spring project. Thanks in advance.
Project configuration:
java -1.7.0
tomcat -6.0 &7.0
ant -1.9.4
spring -4.0.5
enunciate -1.30
jars:
enunciate-core-1.30-RC1.jar
enunciate-core-annotations-1.30-RC1.j
enunciate-core-rt-1.30-RC1.jar
enunciate-java-client-1.30-RC1.jar
enunciate-docs-1.30-RC1.jar
enunciate-rt-1.30-RC1.jar
enunciate-spring-app-rt-1.30-RC1.jar
enunciate-spring-jaxws-rt-1.30-RC1.ja
spring-aop-4.0.5.RELEASE.jar
spring-beans-4.0.5.RELEASE.jar
spring-context-4.0.5.RELEASE.jar
spring-context-support-2.5.4.jar
spring-core-4.0.5.RELEASE.jar
spring-expression-4.0.5.RELEASE.jar
spring-jdbc-4.0.5.RELEASE.jar
spring-test-4.0.5.RELEASE.jar
spring-tx-4.0.5.RELEASE.jar
spring-web-4.0.5.RELEASE.jar
spring-webmvc-4.0.5.RELEASE.jar
This is my enunciate.xml.
enunciate.xml
<?xml version="1.0"?>
<api-classes>
<include pattern="com.sample.controller.*" />
</api-classes>
<modules>
<!-- Docs -->
<docs title="example" copyright="Example.com"/>
<webapp mergeWebXML="WebContent/WEB-INF/web.xml" />
<spring-app disabled="false" springVersion="4.0.5">
<springImport file="resources/dev/applicationContext.xml" />
<springImport file="WebContent/WEB-INF/rest-servlet.xml" />
</spring-app>
<c disabled="true" />
<csharp disabled="true" />
<java-client disabled="false" />
<cxf disabled="false" />
<gwt disabled="false" />
<jaxws-client disabled="true" />
<jaxws-ri disabled="true" />
<jaxws-support disabled="true" />
<jersey disabled="true" />
<xml disabled="false" />
<obj-c disabled="true" />
<rest disabled="false" />
</modules>
properties file for build.xml
enunciate_build.properties
JAVA_HOME=C:/Java/jdk1.7.0/
tomcat.home=D:/xampp/tomcat
This is my build.xml
build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project default = "enunciate">
<property file ="enunciate_build.properties"/>
<property name="lib.dir" value="../libs" />
<property name="src.dir" value="src"/>
<target name = "enunciate">
<path id= "enunciate.classpath">
<fileset dir = "${lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir ="${lib.dir}/modules/spring">
<include name="*.jar"/>
</fileset>
<fileset dir = "${JAVA_HOME}">
<include name = "lib/tools.jar"/>
</fileset>
</path>
<taskdef name="enunciate" classname = "org.codehaus.enunciate.main.EnunciateTask">
<classpath refid = "enunciate.classpath"/>
</taskdef>
<enunciate javacSourceVersion="1.7" javacTargetVersion="1.7" basedir = "${src.dir}" configFile="enunciate.xml">
<include name = "**/*.java"/>
<classpath refid= "enunciate.classpath"/>
<export artifactId="war.file" destination="${tomcat.home}/webapps/sample_enunciate.war"/>
</enunciate>
</target>
</project>
Enunciate only recognizes JAX-RS annotations right now. For further information follow this link.https://github.com/stoicflame/enunciate/issues/60

Spring-Ibatis Deployement exception

Exception:
Caused by: org.springframework.core.NestedIOException: Failed to parse config resource: ServletContext resource [/WEB-INF/SqlMapConfig.xml]; nested exception is com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: java.io.IOException: Could not find resource WEB-INF/ADCampaignDetailsSQLMap.xml
SqlMapConfig.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL MAP Config 2.0//EN" "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<settings useStatementNamespaces="true"/>
<sqlMap resource="WEB-INF/ADCampaignDetailsSQLMap.xml"/>
</sqlMapConfig>
ADCampaignDetailsSQLMap.xml is placed inside WEB-INF of my project folder
And the Above exception is raised when i copied the war file to webapps folder ..
Can any one give me solution for this?
thanks in advance
Edit:
build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project
name="adblendservice"
default="war" >
<property environment="env" />
<property
name="builddir"
value="build/" />
<property
name="srcdir"
value="src/main/java/" />
<property
name="deploydir"
value="deploy/" />
<property
name="wardir"
value="src/main/webapp/" />
<property
name="libdir"
value="${wardir}/WEB-INF/lib/" />
<property file="build.properties" />
<path id="project-classpath" >
<fileset
dir="web/WEB-INF/lib"
includes="*.jar" />
<fileset
dir="${tomcat-home}/lib"
includes="*.jar" />
<!--
<fileset dir="${tomcat-home}/common/lib" includes="*.jar" />
<fileset dir="${tomcat-home}/server/lib" includes="*.jar" />
-->
</path>
<target name="clean" >
<delete
dir="${builddir}"
failonerror="true" />
<echo message="Creating build directories" />
</target>
<target name="war" >
<mkdir dir="${builddir}" />
<mkdir dir="${builddir}/adblendservice/WEB-INF/classes" />
<mkdir dir="${deploydir}" />
<path id="basepath" >
<fileset dir="${wardir}/WEB-INF/lib" >
<include name="**/*.jar" />
</fileset>
</path>
<javac
destdir="${builddir}/adblendservice/WEB-INF/classes"
includeantruntime="false"
srcdir="${srcdir}" >
<classpath refid="basepath" />
</javac>
<war
update="update"
warfile="${builddir}/adblendservice.war"
webxml="${wardir}/WEB-INF/web.xml" >
<classes dir="${builddir}/adblendservice/WEB-INF/classes" />
<fileset dir="${srcdir}" >
<include name="**/*.xml" />
</fileset>
<lib dir="${wardir}/WEB-INF/lib" />
<fileset dir="${wardir}" >
<include name="**/*.xml" />
</fileset>
</war>
</target>
<target
name="deploy"
depends="clean, war" >
<copy
file="${builddir}/adblendservice.war"
todir="${deploydir}" >
</copy>
</target>
</project>
The root of the classpath where iBatis searches for xml files is WEB-INF/classes, not the root of the public web site.
Try to move your xml into the classes directory and point to it without path.
Move your XML files to class path or if it is outside class path, then specify path like <sqlMap resource="../WEB-INF/ADCampaignDetailsSQLMap.xml"/>

Resources