How does Heroku calculate slug size?
I was doing a simple Google web toolkit web app. I used Spring Roo to help me with the boiler code and it created a small app "expenses", the same app as showed at Google IO.
To the generated POM.xml file I added a <artifactId>jetty-runner</artifactId> as one do in the spring mvc tutorial for Heroku.
Now when I run git push heroku master
in the terminal maven start fetching dependencies on the Heroku side and I get [INFO] BUILD SUCCESS
but then Heroku rejects my push.
-----> Push rejected, your compiled slug is 138.0MB (max is 100MB).
See: http://devcenter.heroku.com/articles/slug-size ! Heroku push rejected, slug too large
My generated war file ends up 31Mb when locally created. But the target directory ends up something like the compiled slug size so I added a slugignore file.
$ cat .slugignore
target/*
!target/*.war
Pushed up this to Heroku and it still throws this at me Push rejected, your compiled slug is 138.0MB (max is 100MB).
So my question is Heroku calculate its slug size? I have read their documentation but it's very sparse.
Since this is one of the first links on Google for this, I figured I'd add the solution that I found, via a simple blog post by Chris Auer which details adding a maven plugin execution: http://enlightenmint.com/blog/2012/06/22/reducing-slug-size-for-heroku.html
EDIT: based on oers comment, the highlights from the above link are to declare the maven-clean-plugin in your plugin executions and include the target/ directory (and all subdirectories) while excluding *.war files. The executions phase of that plugin should be invoked on the install phase (not just the clean phase).
In it's entirety (in case that site goes down), it looks about like this:
<plugins>
....
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<filesets>
<fileset>
<directory>target/</directory>
<includes>
<include>**/*</include>
</includes>
<excludes>
<exclude>dependency/*.jar</exclude>
<exclude>*.war</exclude>
</excludes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
</configuration>
<executions>
<execution>
<id>auto-clean</id>
<phase>install</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With