I am trying do sonarqube setup for SAP hybris, we use azure devops for Build and uses ant build to SAP hybris.
sonarqube is located in a seperate server backed by SQL DB and i confirmed it's working.
I want the ant build to communicate to sonarqube server.
In config--> local.properties i added the following sonarqube properties
sonar.projectName=xxx_xxxxxx_xx
sonar.jdbc.url=jdbc:sqlserver://Rxxxxxxxx02:1433;databaseName=soxxrxxxx;integratedSecurity=true
sonar.projectKey=xxx_xxxxxx_xxKey
sonar.projectVersion=1.0
sonar.excludedExtensions=acceleratorcms,acceleratorfacades,acceleratorservices,acceleratorstorefrontcommons,addonsupport,captchaaddon,commercefacades,platformservices
for SonarQube > 6.4
sonar.host.url=http://xxxxxxbldxx:9000
sonar.login=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
can anyone help me on how set this up??
Have you tried Measuring Code Quality with Sonar to configure SAP Commerce Cloud with SonarQube?
Also, when you use sonar.host.url, you don't need sonar.jdbc.url anymore.
the reason is that the ANT task shipped with the Hybris distribution is not compatible with Sonar version 8. In order to solve your problem there are two options:
a) Local workaround
Delete the JAR sonarqube-ant-task-XXX.jar in your platform folder ./platform/resources/ant/sonar/lib. Download a newer version (e.g. sonarqube-ant-task-2.7.0.1612.jar) and place it in the folder ./platform/resources/ant/sonar/lib.
Edit the file ./platform/resources/ant/sonar/sonar.xml and change the element for defining the sonar task. You have to include the new jar file:
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<classpath>
<path path="${platformhome}/resources/ant/sonar/lib/sonarqube-ant-task-2.7.0.1612.jar" />
</classpath>
</taskdef>
After applying this change, you should be able to run ant sonarcheck without the mentioned error.
b) CI-supported solution
If you want to automate your sonar check on a CI server (e.g. Jenkins), you have to override the sonar resources provided by the SAP platform distribution. A common way to do this is to use the customize approach:
create a customize folder in your config folder, e.g. ./hybris/config/customize
add the new jar and modified sonar.xml to this customize directory. So the structure will be:
./hybris/config/customize/platform/resources/ant/sonar/lib/sonarqube-ant-task-2.7.0.1612.jar
./hybris/config/customize/platform/resources/ant/sonar/sonar.xml
In your build job you have to ensure that you invoke this step:
ant customize
This target will override the resources in the platform distribution. It is the offial way stated by SAP to handle such customizations.
After you invoked the ant customize target on your build server, you can build the platform (ant clean all) and invoke the sonar check (ant sonarcheck).
Related
I'm developing some liferay 6.1 themes using plugins sdk, and I want to do continuous integration using jenkins, I have a working jenkins servers with ant installed on it, also my theme project is synchronized with gitlab. The problem here is when I try to build the project using jenkins I have to following problem :
BUILD FAILED /home/settings/.jenkins/jobs/sample Basic
Theme/workspace/sample-theme-2-theme/build.xml:5: The following error
occurred while executing this line:
/home/settings/.jenkins/jobs/sample Basic
Theme/workspace/build-common-theme.xml:5: Cannot find
/home/settings/.jenkins/jobs/sample Basic
Theme/build-common-plugin.xml imported from
/home/settings/.jenkins/jobs/sample Basic
Theme/workspace/build-common-theme.xml
and here is my theme build.xml :
<project name="leyton-theme-2-theme" basedir="." default="deploy">
<import file="../build-common-theme.xml" />
<property name="theme.parent" value="classic" /> </project>
I know the project need the build-common-theme.xml which is located on his parent file theme, but I want only my theme project to be in git not the whole directory.
If you don't want to commit your entire Plugins SDK to git repository, then you should switch to using maven, because it will be more effort for you to make changes to build.xml files to make it working without the parent build.xml files.
Have a look at this very good blog post, and also detailed documentation on using Maven to develop Lifeary plugins.
I might be missing something, but I have been struggling with this problem for some time now.
I have an Web application with Ant build script. I would like to set up an Artifact to this module, (which is the .war file, generated using ant), so that I could deploy this war file, to the configured Tomcat server.
But I am not able to figure out, how to make Intellij use my Ant script to build artifact. I see an option to Run Ant Targets, but this just runs the Ant target and Intellij then proceeds to generate Artifact, in the usual way.
Please let me know if the question is ambiguous. The problem is not Ant Integration with Intellij. I could just use the Ant window and run any target and also could make an Ant target run as part of Build. The problem is to associate an Artifact to a module and leverage the Ant script to build that artifact. I need this to enable, tight tomcat integration, Since while integrating the Tomcat server, I can specify an artifact to be deployed.
Note: Intellij IDEA version 11.1
IDEA can either deploy Artifact or the External Source (directory or file) that is built by Ant or any other tool:
It's not possible to associate IDEA Artifact with Ant build.
I know that, we can very well use ANT and Maven together to build the project.We can run ANT scripts through Maven's POM.xml. But my question is can we run pom.xml through ANT's build.xml ?
i.e. can we create maven build from build.xml
Yes, using maven ant tasks.
The page lists out multiple maven tasks which can be integrated into an ant build script, thus combining the features of both. To take an example, there is the mvn task, which as documented can do a full maven build from ant.
<artifact:mvn mavenHome="/path/to/maven-3.0.x">
<arg value="install"/>
</artifact:mvn>
Besides this, there are
Dependencies task
Install and Deploy tasks
Pom task
each described with examples.
Maven and ANT are very different build tools. In ANT you write all the logic yourself, whereas a standard build process is "baked in" with Maven.
The POM file contains no logic, instead it contains a series of declarations about your project.
If you understand well how Maven works, it is theoretically possible to take a POM and generate an ANT build that emulates the behaviour of the Maven build. I'm not aware of any solution which can easily convert in the other direction, mainly because ANT is missing Maven functionality, such as dependency management.
Instead of trying to convert an ANT build into Maven, I'd recommend that you keep your existing build logic and delegate the management of your classpath to the ivy or Maven ANT tasks. These tools also provide tasks to publish your build output to a Maven repository, enabling your project to share with other projects using Maven.
Finally, I'm an ivy advocate and wrote an ant2ivy script which can assist in upgrade process. It creates an initial set of configuration files for downloading your projects dependencies from the Maven central repository.
I would like to utilize the RTC (v2.x) build for Java EE projects created in RAD (v8) and deploy them on WebSphere (v7).
Independently of RTC build i am able to create all sorts of ant scripts and jython scripts to perform automated tasks. The problem is to integrate this into a single RTC build.
The path I'm on now is:
- RTC build definition calls external build command which is a ms-dos .bat file that call's the Rational Build Utility headless ant with an ant build script.
- The ant build script uses 1)projectImport 2)workspaceBuild and 3)exec to call wsadmin with a jython deploy script.
Right now the build fails because the workspaceBuild task fails because we've defined a target runtime that does not exist in the headlles ant workspace. If someone knows how to add/define a new target runtime into a headless ant workspace that would be very helpfull.
I can't help feeling that i'm on the wrong track and feel quit stuck between the different environments and I'm wondering how other people implement their RTC build for a WebSphere target.
Thanks.
There's a DeveloperWorks article that explains how to use the RAD Ant tasks in a continuous build scenario. For the target runtime, you would define that in Eclipse, export your preferences, then import them during the build using the workspacePreferenceFile Ant task with useEclipsePrefs="true". The article uses Hudson, but the same approach should work for RTC Build.
Is there any tutorial to show how can I use MSBuild tasks like FtpUploadDirectoryContent to copy file/directory to a remote host using FTP in Team Build 2010? I never used a MSBuild task in TFS 2010.
Just put it in the AfterBuild target of one of your projects - probably best to put it in the project that's at the top of your dependency graph. You can add a condition if you don't want it to run in Visual Studio, or if you only want to do the FTP transfer for a particular build configuration. For example:
<Project>
...
<Target Name="AfterBuild" Condition="'$(BuildingInsideVisualStudio)'!='true'" >
<!-- Insert your FTP task here -->
</Target>
</Project>
See How to: Extend the Visual Studio Build Process
You might consider modifying your build process template (WF) and using the InvokeProcess activity call out to FTP.exe.
There are also a handful of FTP activities and command line utilties if the built in Windows FTP command line client doesn't work for you.