marceloverdijk / lesscss-maven-plugin

LESS CSS Maven Plugin
170 stars 59 forks source link

Stuck on a loop? #70

Open coladict opened 10 years ago

coladict commented 10 years ago

We've recently started using Less in our project and it compiles for less than a second with the node-less package under Ubuntu. I tried to add it to the maven build, so we can remove the file from the Git repo, because it blows-up the patches. I waited 10 minutes for it to compile with this plugin before I stopped it. This is our plugin configuration.

            <plugin>
                <groupId>org.lesscss</groupId>
                <artifactId>lesscss-maven-plugin</artifactId>
                <version>1.7.0.1.1</version>
                <configuration>
                    <sourceDirectory>${project.basedir}/src/main/webapp/less</sourceDirectory>
                    <outputDirectory>${project.build.directory}/${project.build.finalName}/css</outputDirectory>
                    <includes>
                        <include>style.less</include>
                    </includes>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

These are our Less scripts https://www.dropbox.com/s/i06njcgy184t4hz/less.tar.gz?dl=0

Also, these are the maven compile logs with -X when I was done waiting and stopped it:

[INFO] 
[INFO] --- lesscss-maven-plugin:1.7.0.1.1:compile (default) @ webapp ---
[DEBUG] org.lesscss:lesscss-maven-plugin:jar:1.7.0.1.1:
[DEBUG]    commons-logging:commons-logging:jar:1.1.1:compile
[DEBUG]    commons-io:commons-io:jar:2.4:compile
[DEBUG]    org.apache.maven:maven-plugin-api:jar:2.0:compile
[DEBUG]    org.codehaus.plexus:plexus-utils:jar:3.0:compile
[DEBUG]    org.lesscss:lesscss:jar:1.7.0.1.1:compile
[DEBUG]       org.mozilla:rhino:jar:1.7R4:compile
[DEBUG]       org.slf4j:slf4j-simple:jar:1.7.2:runtime
[DEBUG]          org.slf4j:slf4j-api:jar:1.7.2:runtime
[DEBUG]    org.sonatype.plexus:plexus-build-api:jar:0.0.7:compile
[DEBUG] Created new class realm plugin>org.lesscss:lesscss-maven-plugin:1.7.0.1.1
[DEBUG] Importing foreign packages into class realm plugin>org.lesscss:lesscss-maven-plugin:1.7.0.1.1
[DEBUG]   Imported:  < maven.api
[DEBUG] Populating class realm plugin>org.lesscss:lesscss-maven-plugin:1.7.0.1.1
[DEBUG]   Included: org.lesscss:lesscss-maven-plugin:jar:1.7.0.1.1
[DEBUG]   Included: commons-logging:commons-logging:jar:1.1.1
[DEBUG]   Included: commons-io:commons-io:jar:2.4
[DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:3.0
[DEBUG]   Included: org.lesscss:lesscss:jar:1.7.0.1.1
[DEBUG]   Included: org.mozilla:rhino:jar:1.7R4
[DEBUG]   Included: org.slf4j:slf4j-simple:jar:1.7.2
[DEBUG]   Included: org.slf4j:slf4j-api:jar:1.7.2
[DEBUG]   Included: org.sonatype.plexus:plexus-build-api:jar:0.0.7
[DEBUG]   Excluded: org.apache.maven:maven-plugin-api:jar:2.0
[DEBUG] Configuring mojo org.lesscss:lesscss-maven-plugin:1.7.0.1.1:compile from plugin realm ClassRealm[plugin>org.lesscss:lesscss-maven-plugin:1.7.0.1.1, parent: sun.misc.Launcher$AppClassLoader@7694837a]
[DEBUG] Configuring mojo 'org.lesscss:lesscss-maven-plugin:1.7.0.1.1:compile' with basic configurator -->
[DEBUG]   (f) compress = false
[DEBUG]   (f) encoding = UTF-8
[DEBUG]   (f) force = false
[DEBUG]   (f) includes = [style.less]
[DEBUG]   (f) outputDirectory = /home/ME/workspace/PROJECT/target/ROOT/css
[DEBUG]   (f) skip = false
[DEBUG]   (f) sourceDirectory = /home/ME/workspace/PROJECT/src/main/webapp/less
[DEBUG]   (f) watch = false
[DEBUG]   (f) watchInterval = 1000
[DEBUG] -- end configuration --
[DEBUG] sourceDirectory = /home/ME/workspace/PROJECT/src/main/webapp/less
[DEBUG] outputDirectory = /home/ME/workspace/PROJECT/target/ROOT/css
[DEBUG] includes = [style.less]
[DEBUG] excludes = []
[DEBUG] force = false
[DEBUG] lessJs = null
[DEBUG] skip = false
[DEBUG] included files = [style.less]
[INFO] Compiling LESS source: style.less...
^C
MartinCui commented 9 years ago

the same for me. But it works fine for single simple less files. So I guess it's related to something with \@import like @import "../../../../xxx/1.1.1/xxxx/less/xxxxx.less"; which is outside of "sourceDirectory".

coladict commented 9 years ago

Update: I removed the following form style.less and it compiled

@import "variables.less";
@import "mixins.less";
@import "navs.less";
@import "glyphicons.less";
@import "carousel.less";

They were all duplicates from bootstrap.less (external package, not ours, obviously), however, the first two files seem to have name twins in ./ and ../font-awesome/less/ (relative to style.less) with totally different contents.

nitinsurana commented 9 years ago

In my case, it hangs at "Watching..." nothing happens. I'm using Windows if it matters, although I tried on ubuntu & same thing. If I remove <watch>true</watch> then it passes.

I'm using maven tomcat7 plugin to run the app through embedded tomcat server using the following command.

mvn tomcat7:run -Pdev

dev profile contains the lesscss maven plugin

imbroglioj commented 9 years ago

Same problem here on Ubuntu. Running with less.js (lessc) and minimizing with --clean-css takes about 2 seconds max. Running with maven lesscss and no minimizing blows up with out-of-memory error. If I increase memory to about -Xmx2048m then it just runs forever. We have a large less file that imports many of the Bootstrap less files. There are about 3 visible layers of import:

For now, I have commented out the lesscss plugin call and am storing the final css file in git. Next approach will be to add node.js calls to our maven build (pretty painful) to use less.js. I will track this issue for alternatives. Willing to send our less files to anyone who wants them for testing. No significant IP there and no shame since I only inherited them.