Skip to content

Instantly share code, notes, and snippets.

@mkristian
Last active August 2, 2016 14:28
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mkristian/1671207 to your computer and use it in GitHub Desktop.
Save mkristian/1671207 to your computer and use it in GitHub Desktop.
using gem-maven-plugin to compass compile or execute sass. sass with gem dependency within plugin and compass with global compile dependency (which is also added to the java-classpath and not so nice)
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>example</artifactId>
<version>0.0.36</version>
<repositories>
<repository>
<id>rubygems-releases</id>
<url>http://rubygems-proxy.torquebox.org/releases</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>rubygems</groupId>
<artifactId>compass</artifactId>
<version>0.11.7</version>
<type>gem</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>de.saumya.mojo</groupId>
<artifactId>gem-maven-plugin</artifactId>
<version>0.29.4</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
<configuration>
<!--jrubyVersion>1.7.2</jrubyVersion-->
<execArgs>${project.build.directory}/rubygems/bin/compass compile ${basedir}/src/main/sass</execArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>example</artifactId>
<version>0.0.36</version>
<pluginRepositories>
<pluginRepository>
<id>rubygems-releases</id>
<url>http://rubygems-proxy.torquebox.org/releases</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>de.saumya.mojo</groupId>
<artifactId>gem-maven-plugin</artifactId>
<version>0.29.4</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<jrubyVersion>1.7.2</jrubyVersion>
<execArgs>${project.build.directory}/rubygems/bin/sass --update ${basedir}/src/main/sass</execArgs>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>rubygems</groupId>
<artifactId>sass</artifactId>
<version>3.2.5</version>
<type>gem</type>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
@gastonfournier
Copy link

Hi! I'm having a problem with this plugin. It seems that a class is missing, maybe I need to import another dependency. Here's the log i get:
Number of imports: 10
import: org.codehaus.classworlds.Entry@a6c57a42
import: org.codehaus.classworlds.Entry@12f43f3b
import: org.codehaus.classworlds.Entry@20025374
import: org.codehaus.classworlds.Entry@f8e44ca4
import: org.codehaus.classworlds.Entry@92758522
import: org.codehaus.classworlds.Entry@ebf2705b
import: org.codehaus.classworlds.Entry@bb25e54
import: org.codehaus.classworlds.Entry@bece5185
import: org.codehaus.classworlds.Entry@3fee8e37
import: org.codehaus.classworlds.Entry@3fee19d8

this realm = plexus.core
urls[0] = file:/usr/share/maven2/lib/maven-debian-uber.jar
Number of imports: 10
import: org.codehaus.classworlds.Entry@a6c57a42
import: org.codehaus.classworlds.Entry@12f43f3b
import: org.codehaus.classworlds.Entry@20025374
import: org.codehaus.classworlds.Entry@f8e44ca4
import: org.codehaus.classworlds.Entry@92758522
import: org.codehaus.classworlds.Entry@ebf2705b
import: org.codehaus.classworlds.Entry@bb25e54
import: org.codehaus.classworlds.Entry@bece5185
import: org.codehaus.classworlds.Entry@3fee8e37

import: org.codehaus.classworlds.Entry@3fee19d8

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Internal error in the plugin manager executing goal 'de.saumya.mojo:gem-maven-plugin:0.28.6:exec': Unable to load the mojo 'de.saumya.mojo:gem-maven-plugin:0.28.6:exec' in the plugin 'de.saumya.mojo:gem-maven-plugin'. A required class is missing: org/apache/maven/repository/legacy/metadata/MetadataResolutionRequest
org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest

Any idea what the problem may be? I saw somewhere that it runs on maven 3, maybe that's the problem?

$ mvn -version
Apache Maven 2.2.1 (rdebian-8)
Java version: 1.6.0_30
Java home: /usr/lib/jvm/java-6-sun-1.6.0.30/jre
Default locale: es_AR, platform encoding: UTF-8
OS name: "linux" version: "3.2.0-37-generic-pae" arch: "i386" Family: "unix"

@gastonfournier
Copy link

FYI I Installed maven3 following http://blog.btmatthews.com/2011/08/04/installing-maven-3-on-ubuntu-11-04-lts-server/ and build it without any problem.
Great plugin!

@mkristian
Copy link
Author

hoops - never saw any notification on those comments.

@gastonfournler yes - that plugin needs maven3 ;)

@Mhsh still problems ? I can not help you with sass but on how to add a config file. windows is also a bit of problem for me

@hatescheese
Copy link

Hi There, I am trying to specify my includes directory like I do using compass but maven seems to be failing with the following error "Error: invalid option: -I" are includes not supported with this plugin?
Here is what I am doing, maybe I am not doing it right
<execArgs> ${project.build.directory}/rubygems/bin/compass compile --sass-dir ${basedir}/src/SCSS/stylesheets --css-dir ${basedir}/target/CSS -I ${basedir}/src/SCSS/includes </execArgs>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment