Maven build with SASS does not work in Jenkins - maven

I have a project, which builds fine locally. When I run mvm clean deploy it builds fine and the sass-maven plugin gives me the following output:
[INFO] --- sass-maven-plugin:1.1.1:update-stylesheets (default) # myapp-web ---
[INFO] Compiling SASS Templates
[INFO] Queing SASS Template for compile: /Users/750250/Projects/myapp/webapp/src/main/webapp => /Users/750250/Projects/myapp/webapp/src/main/webapp
[INFO] >> /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/features/abTestStyles/css/S7669.abTest.boldKeywords.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/features/abTestStyles/css/S7669.abTest.boldKeywords.css
[INFO] >> /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/features/abTestStyles/css/S7728.abTest.common.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/features/abTestStyles/css/S7728.abTest.common.css
[INFO] >> /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/features/abTestStyles/css/S7728.abTest.noDescription.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/features/abTestStyles/css/S7728.abTest.noDescription.css
[INFO] >> /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/pages/coolSearchResults/css/coolSearchResults.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/pages/coolSearchResults/css/coolSearchResults.css
[INFO] >> /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/pages/hotSearchResults/css/hotSearchResults.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/pages/hotSearchResults/css/hotSearchResults.css
[INFO] >> /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/homeStatic.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/homeStatic.css
[INFO] >> /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/merchant.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/merchant.css
[INFO] >> /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/offer.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/offer.css
[INFO] >> /Users/750250/Projects/bizratmyappe-eu-webapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/product.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/product.css
[INFO] >> /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/searchResults.scss => /Users/750250/Projects/myapp/webapp/src/main/webapp/catalogue/theme/bi_fr/css/pages/searchResu
Indicating that it works. However, when the same thing is run from Jenkins, I get the following output from the plugin
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - --- sass-maven-plugin:1.1.1:update-stylesheets (default) # myapp-web ---
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger -
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- sass-maven-plugin:1.1.1:update-stylesheets (default) # myapp-web ---
[pool-1-thread-1] INFO org.jasig.maven.plugin.sass.UpdateStylesheetsMojo - Compiling SASS Templates
[pool-1-thread-1] INFO org.jasig.maven.plugin.sass.UpdateStylesheetsMojo - Queing SASS Template for compile: /home/sitebuild/jenkins/workspace/{myapp}-myapp-webapp-{S7515}/webapp/src/main/webapp => /home/sitebuild/jenkins/workspace/{myapp}-myapp-webapp-{S7515}/webapp/src/main/webapp
It appears that it is just ignoring or not picking up the contents of that directory.
What would cause this behaviour when running the sass-maven-plugin within jenkins?

I have replicated your issue and it appears to be a bug in the SASS plugin - the good news is there is a workaround.
The absolute path your Jenkins server is passing to the plugin contains curly braces. This is a common source of bugs in Ruby programs, which the Maven SASS plugin is. Doing this locally replicated your problem exactly - the plugin starts, then simply does not compile anything.
When I built a POM that used relative paths instead of absolute paths (src/main/sass vs ${project.dir}/src/main/sass)), it was possible to build in a directory whose path contained curly braces.
It would be good if the plugin reported that the path it is trying to compile from seems problematic though.

Related

unable to build app on appcelerator studio

I am not able to build android app project on appcelerator studio.
I am using Titanium sdk 5.1.1.GA the console just stops after extracting module resources, see below:
[INFO] : Encrypting JavaScript files: C:\ProgramData\Titanium\mobilesdk\win32\5.1.1.GA\android\titanium_prep.win32.exe "com.test7" "C:\Users\Fatimah\Documents\Appcelerator_Studio_Workspace\test7\build\android\assets" "app.js" "iphone/ui/ApplicationWindowPlatform.js" "iphone/ui/Drawer.js" "ui/ApplicationWindow.js" "ui/Drawer.js" "ui/ApplicationWindowPlatform.js" "_app_props_.json"
[INFO] : Writing C:\Users\Fatimah\Documents\Appcelerator_Studio_Workspace\test7\build\android\bin\assets\app.json
[INFO] : Extracting module resources: C:\ProgramData\Titanium\mobilesdk\win32\5.1.1.GA\android\modules\titanium-analytics.res.zip
[INFO] : Extracting module resources: C:\ProgramData\Titanium\mobilesdk\win32\5.1.1.GA\android\modules\titanium-android.res.zip
[INFO] : Extracting module resources: C:\ProgramData\Titanium\mobilesdk\win32\5.1.1.GA\android\modules\titanium-app.res.zip
[INFO] : Extracting module resources: C:\ProgramData\Titanium\mobilesdk\win32\5.1.1.GA\android\modules\titanium-filesystem.res.zip
[INFO] : Extracting module resources: C:\ProgramData\Titanium\mobilesdk\win32\5.1.1.GA\android\modules\titanium-media.res.zip
I'm not sure why the build would get stuck extracting the modules. Try cleaning your project, then building again. You might get lucky.
It could also be your Node.js version. We use a pretty old Node module called "adm-zip" for extracting zip files, so it's possible it's being finicky. Try using Node.js 4.x or 0.12.

Setting encoding for SCM Activity plugin for sonar-maven-plugin?

I use SonarQube 4.2 with SCM Activity [scmactivity] 1.7 with sonar-maven-plugin 4.2.
Upon executing mvn sonar:sonar I'm seeing the following:
[INFO] --- sonar-maven-plugin:4.2:sonar (default-cli) # ... ---
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: ...\target\sonar
INFO: SonarQube Server 4.2
...
[INFO] [15:43:51.829] Source encoding: UTF-8, default locale: en_US
...
[INFO] [15:43:59.169] Sensor ScmActivitySensor...
[INFO] [15:43:59.169] Trying to guess scm provider from project layout...
[INFO] [15:43:59.170] Found SCM type: svn
[INFO] [15:43:59.170] Retrieve SCM blame information with encoding windows-1250...
[INFO] [15:43:59.343] Retrieve SCM blame information with encoding windows-1250 done: 173 ms
[INFO] [15:43:59.345] Sensor ScmActivitySensor done: 176 ms
How can the encoding be set up to another one, say UTF-8?
Try adding these to the properties section of the POM:
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
Currently you can't. This is the line responsible for printing the encoding:
TimeProfiler profiler = new TimeProfiler().start("Retrieve SCM blame information with encoding " + Charset.defaultCharset());
However, this is somewhat misleading, because author names are always normalized and stripped of all non ascii characters:
authors.add(lineNumber, normalizeString(line.getAuthor()));
...
private String normalizeString(String inputString) {
String lowerCasedString = inputString.toLowerCase();
String stringWithoutAccents = removeAccents(lowerCasedString);
return removeNonAsciiCharacters(stringWithoutAccents);
So actually, the encoding has no impact.

using Typesafe Activator on Windows

I tried to run the hello-slick template from inside Typesafe Activator.
When it recompiled it produced:
Refreshing list of source files to watch for changes...
[info] Loading global plugins from C:\Users\Edward G Prentice\.sbt\plugins\project
[info] Loading global plugins from C:\Users\Edward G Prentice\.sbt\plugins
[info] Loading project definition from C:\Users\Edward G Prentice\hello-slick\project
[info] Set current project to hello-slick (in build file:/C:/Users/Edward%20G%20Prentice/hello-slick/)
[error] Expected '"'
[error] apply -cp "C:/Users/Edward
[error] ^
Failed to reload source file list: sbt process never got in touch, so unable to handle request WatchTransitiveSourcesRequest(true)
so clearly it is not expecting spaces in that portion of the classpath. I understand what's failing but not how to fix it.
...and what is the best channel to resolve problems with Typesafe Activator?

How to make cuke4duke find step definitions

I have configured cuke4duke and Cucumber with maven and written feature and step definition files.
My feature file is located at [ProjectDir]\features\example2.feature
Feature: Example of a feature file
As some aspiring cuke4duke user
I want an example of how it works
So that I can easily setup my project to use it
# This should pass
Scenario: A simple passing scenario
Given the letter 'A'
When I check the letter
Then the letter should be 'A'
My step definitions are located at [ProjectDir]\src\test\java\Example2Steps.java
package test.java;
import cuke4duke.annotation.I18n.EN.Given;
import cuke4duke.annotation.I18n.EN.Then;
import cuke4duke.annotation.I18n.EN.When;
import static org.junit.Assert.assertThat;
import static org.hamcrest.CoreMatchers.is;
public class Example2Steps {
private char theLetter;
#Given("^the letter 'A'$")
public void gimmeALetter(final char theLetter) {
this.theLetter = theLetter;
}
#When("^I check the letter$")
public void checkThem() {
// just a stub
}
#Then("^the letter should be 'A'$")
public void checkTheLetter(final char aLetter) {
assertThat(theLetter, is(aLetter));
}
}
When I run "mvn integration-test" at project dir in Windows command prompt it builds fine, but tells me that the scenario and steps are undefined.
Output:
[INFO] [cuke4duke:cucumber {execution: run-features}]
[INFO] Feature: Example of a feature file
[INFO] As some aspiring cuke4duke user
[INFO] I want an example of how it works
[INFO] So that I can easily setup my project to use it
[INFO]
[INFO] # This should pass
[INFO] Scenario: A simple passing scenario # features\example2.feature:7
[INFO] Given the letter 'A' # features\example2.feature:8
[INFO] When I check the letter # features\example2.feature:9
[INFO] Then the letter should be 'A' # features\example2.feature:10
[INFO]
[INFO] 1 scenario (1 undefined)
[INFO] 3 steps (3 undefined)
[INFO] 0m0.053s
[INFO]
[INFO] You can implement step definitions for undefined steps with these snippets:
[INFO]
[INFO] Given /^the letter 'A'$/ do
[INFO] pending # express the regexp above with the code you wish you had
[INFO] end
[INFO]
[INFO] When /^I check the letter$/ do
[INFO] pending # express the regexp above with the code you wish you had
[INFO] end
[INFO]
[INFO] Then /^the letter should be 'A'$/ do
[INFO] pending # express the regexp above with the code you wish you had
[INFO] end
[INFO]
[INFO] If you want snippets in a different programming language, just make sure a file
[INFO] with the appropriate file extension exists where cucumber looks for step definitions.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
As far as I can read anywhere, cuke4duke looks for step definitions at [ProjectDir]\src\test\java\, why can't it find my definitions?
In the end it was wrong case in some of my Maven pom tags that caused the error.
I cross-checked my pom and other project files with the following
example project, and now it all works!
https://github.com/jamesladd/maven-cuke4duke-jump-start

luntbuild + maven + findbugs = OutOfMemoryException

I've been trying to get Luntbuild to generate and publish a project site for our project including a Findbugs report. All other reports (Cobertura, Surefire, JavaDoc, Dashboard) work fine, but Findbugs bails out with an OutOfMemoryException. Excluding findbugs from report generation fixes the build --- although obviously without a Findbugs report.
The funny thing is that I first encountered this problem locally and solved it by setting MAVEN_OPTS=-Xmx512m. This does not seem to be enough in Luntbuild, however: setting that exact same option as an environment variable of my builder doesn't make a difference.
I've found a couple of posts on the 'net stating you should also add -XX:MaxPermSize=512m to MAVEN_OPTS and/or pass -Dmaven.findbugs.jvmargs=-Xmx512m to mvn.bat. None of these (or their combination) seem to help though so any hints would be greatly appreciated!
Cheers,
Johannes
Relevant information:
Luntbuild is 1.5.6, Maven is 2.1.0, findbugs-maven-plugin is 2.0.1.
This is the Findbugs section of the relevant pom.xml:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.0.1</version>
</plugin>
This is the head of my build log:
User "luntbuild" started the build
Perform checkout operation for VCS setting:
Vcs name: Subversion
Repository url base: http://some.repository.com/repo/
Repository layout: multiple
Directory for trunk: trunk
Directory for branches: branches
Directory for tags: tags
Username: xxxx
Password:xxxx
Web interface: ViewVC
URL to web interface: http://some.repository.com/repo/
Quiet period:
modules:
Source path: somepath, Branch: , Label: , Destination path: somewhere
Source path: somepath, Branch: somewhere1.0.x, Label: , Destination path: somewhere-1.0.x
Source path: somepath, Branch: somewhere1.1.x, Label: , Destination path: somewhere-1.1.x
Update url: http://some.repository.com/repo//trunk
Duration of the checkout operation: 0 minutes
Perform build with builder setting:
Builder name: default
Builder type: Maven2 builder
Command to run Maven2: "C:\maven\apache-maven-2.1.0\bin\mvn.bat" -e -f somewhere\pom.xml -P site -Dmaven.test.skip=false -DbuildDate="Tue Nov 24 11:13:24 CET 2009" -DbuildVersion="site-core138"
-Dsvn.username=xxxx -Dsvn.password=xxxx -DstagingSiteURL=file:///C:/luntbuild/core-reports
-Dmaven.findbugs.jvmargs=-Xmx512m
Directory to run Maven2 in:
Goals to build: site:stage site:stage-deploy
Build properties: buildVersion="site-core138"
artifactsDir="C:\\Program Files\\Luntbuild\\publish\\somewhere\\site-core\\site-core138\\artifacts"
buildDate="Tue Nov 24 11:13:24 CET 2009"
junitHtmlReportDir=""
Environment variables: MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=512m"
Build success condition: result==0 and builderLogContainsLine("INFO","BUILD SUCCESSFUL")
Execute command: Executing 'C:\maven\apache-maven-2.1.0\bin\mvn.bat' with arguments:
'-e'
'-f'
'somewhere\pom.xml'
'-P'
'site'
'-Dmaven.test.skip=false'
'-DbuildDate=Tue Nov 24 11:13:24 CET 2009'
'-DbuildVersion=site-core138'
'-Dsvn.username=xxxxxx'
'-Dsvn.password=xxxxxx'
'-DstagingSiteURL=file:///C:/luntbuild/reports'
'-Dmaven.findbugs.jvmargs=-Xmx512m'
'-DbuildVersion=site-core138'
'-DartifactsDir=C:\\Program Files\\Luntbuild\\publish\\somewhere\\site-core\\site-core138\\artifacts'
'-DbuildDate=Tue Nov 24 11:13:24 CET 2009'
'-X'
'site:stage'
'site:stage-deploy'
Tail of my build log:
Analyzed: C:\luntbuild\somewhere-work\somewhere\...\SomeClass.class
...
Analyzed: C:\luntbuild\somewhere-work\somewhere\...\target\classes
Aux: C:\luntbuild\somewhere-work\somewhere\...\target\classes
Aux: c:\maven\local-repo\...\somejar-1.1.1.1-SNAPSHOT.jar
Aux: c:\maven\local-repo\commons-lang\commons-lang\2.3\commons-lang-2.3.jar
....
Aux: c:\maven\local-repo\org\openoffice\ridl\3.1.0\ridl-3.1.0.jar
Aux: c:\maven\local-repo\org\openoffice\unoil\3.1.0\unoil-3.1.0.jar
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Java heap space
[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
java.lang.OutOfMemoryError: Java heap space
at java.util.HashMap.(HashMap.java:209)
at edu.umd.cs.findbugs.ba.type.TypeAnalysis$CachedExceptionSet.(TypeAnalysis.java:114)
at edu.umd.cs.findbugs.ba.type.TypeAnalysis.getCachedExceptionSet(TypeAnalysis.java:688)
at edu.umd.cs.findbugs.ba.type.TypeAnalysis.computeThrownExceptionTypes(TypeAnalysis.java:439)
at edu.umd.cs.findbugs.ba.type.TypeAnalysis.transfer(TypeAnalysis.java:411)
at edu.umd.cs.findbugs.ba.type.TypeAnalysis.transfer(TypeAnalysis.java:89)
at edu.umd.cs.findbugs.ba.Dataflow.execute(Dataflow.java:356)
at edu.umd.cs.findbugs.classfile.engine.bcel.TypeDataflowFactory.analyze(TypeDataflowFactory.java:82)
at edu.umd.cs.findbugs.classfile.engine.bcel.TypeDataflowFactory.analyze(TypeDataflowFactory.java:44)
at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.analyzeMethod(AnalysisCache.java:331)
at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getMethodAnalysis(AnalysisCache.java:281)
at edu.umd.cs.findbugs.classfile.engine.bcel.CFGFactory.analyze(CFGFactory.java:173)
at edu.umd.cs.findbugs.classfile.engine.bcel.CFGFactory.analyze(CFGFactory.java:64)
at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.analyzeMethod(AnalysisCache.java:331)
at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getMethodAnalysis(AnalysisCache.java:281)
at edu.umd.cs.findbugs.ba.ClassContext.getMethodAnalysis(ClassContext.java:937)
at edu.umd.cs.findbugs.ba.ClassContext.getMethodAnalysisNoDataflowAnalysisException(ClassContext.java:921)
at edu.umd.cs.findbugs.ba.ClassContext.getCFG(ClassContext.java:326)
at edu.umd.cs.findbugs.detect.BuildUnconditionalParamDerefDatabase.analyzeMethod(BuildUnconditionalParamDerefDatabase.java:103)
at edu.umd.cs.findbugs.detect.BuildUnconditionalParamDerefDatabase.considerMethod(BuildUnconditionalParamDerefDatabase.java:93)
at edu.umd.cs.findbugs.detect.BuildUnconditionalParamDerefDatabase.visitClassContext(BuildUnconditionalParamDerefDatabase.java:79)
at edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:68)
at edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:971)
at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:222)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17 minutes 16 seconds
[INFO] Finished at: Tue Nov 24 11:31:23 CET 2009
[INFO] Final Memory: 70M/127M
[INFO] ------------------------------------------------------------------------
Maven2 builder failed: build success condition not met!
Note that apparently maven only uses 70MB... but that probably doesn't mean anything since the Findbugs plugin forks its own process.
I don't have any experience with either of: Luntbuild or maven, but this might help you:
if the error message is "OutOfMemoryError: Java heap space", then Xmx setting is the one for you. -XX:MaxPermSize=512m option deals with PermGen space, which is a different one.
If, as you mention, FindBugs starts its own process, then setting MAVEN_OPTS doesn't seem to be relevant. I would suggest trying to find how to set the Xmx for FindBugs JVM. Probably others will come with details on how to do it.
EDIT:
Documentation for Maven FindBugs Plugin seems to cover the topic of setting heap size. The default value is 512M and you can change it using maxHeap. The only problem is that it seems to be possible only since version 2.2.

Resources