How can I disable the YUI compressor when building a jira plugin?

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 19, 2011

Hi -

mvn package is falling over when trying to compress a utf-8 encoded file... what maven snippet do I need to specify the encoding?

Also it's attempting to compress already minified files resulting in them actually getting bigger - how can I disable the compressor altogether?

cheers, jamie

9 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

15 votes
Answer accepted
Igor Sereda [ALM Works]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 20, 2011

Try this:

<build>

<plugins>

<plugin>

<groupId>com.atlassian.maven.plugins</groupId>

<artifactId>maven-jira-plugin</artifactId>

<version>3.3.1</version>

<extensions>true</extensions>

<configuration>

<compressResources>false</compressResources>

</configuration>

</plugin>

</plugins>

</build>

<profiles>

<profile>

<id>release</id>

<build>

<plugins>

<plugin>

<groupId>com.atlassian.maven.plugins</groupId>

<artifactId>maven-jira-plugin</artifactId>

<configuration>

<systemPropertyVariables>

<plugin.resource.directories>${basedir}/target/classes</plugin.resource.directories>

<atlassian.dev.mode>false</atlassian.dev.mode>

</systemPropertyVariables>

</configuration>

</plugin>

</plugins>

</build>

</profile>

</profiles>

Igor Sereda [ALM Works]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 20, 2011

Put maven-jira-plugin version there to show the version known to work.

Also we have <extensions>true</extensions> under <plugin> - not sure if that's relevant

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 21, 2011

doesn't work either!

with extensions: false I get:

Cannot find lifecycle mapping for packaging: 'atlassian-plugin'.

Igor Sereda [ALM Works]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 21, 2011

Hmm... I know for a fact that our plugin's resources don't go through minification during build (we use other minification tools).

I'm editing the answer to add more from our POM

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 3, 2011

<compressResources>false</compressResources> worked great! Nothing minimized which is what I need now. Thanks. That leaves the question about how to selectively stop it from handling files it shouldn't. It is not clear why the default is to minimize non-js or non-css files in the first place.

EddieW
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 19, 2013

Hey alright! This worked for me on confluence!

&lt;plugin&gt;
				&lt;groupId&gt;com.atlassian.maven.plugins&lt;/groupId&gt;
				&lt;artifactId&gt;maven-confluence-plugin&lt;/artifactId&gt;
				&lt;version&gt;${amps.version}&lt;/version&gt;
				&lt;extensions&gt;true&lt;/extensions&gt;
				&lt;configuration&gt;
					&lt;productVersion&gt;${confluence.version}&lt;/productVersion&gt;
					&lt;productDataVersion&gt;${confluence.data.version}&lt;/productDataVersion&gt;
					&lt;compressResources&gt;false&lt;/compressResources&gt;
				&lt;/configuration&gt;
			&lt;/plugin&gt;

Like Timur Akman likes this
Kinto Soft
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 8, 2013

+1 for the Igor's answer.

Pascal Charbonneau May 11, 2013

Also a BIG +1 as I have been chasing this for days trying to work with CLI/pi to debug some Javascript. Works like a charm now :)

1 vote
kyona August 10, 2018

Do not forget to run "atlas-clean" to delete old minified javascript files before building a new package with "atlas-packages"

All of 3 options

<compressJs>false</compressJs>
<compressCss>false</compressCss>
<compressResources>false</compressResources>

are working for me now when pasted to configuration block as Igor Sereda mentioned.

1 vote
AdrienA March 11, 2012

The YUICompressor is called by Amps, the Atlassian maven plugin which compiles your jar. AMPS calls it with the current pom as a context, so you can configure it in your pom.xml. It has a <skip> configuration parameter, so this would probably be a good way to go:

<project>
  ...
  <build>
    ...
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>net.sf.alchim</groupId>
          <artifactId>yuicompressor-maven-plugin</artifactId>
          <!-- The version is probably not necessary -->
          <version>0.7.1</version>
          <configuration>
              <skip>true</skip>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    ...
  </build>
</project>

EddieW
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 19, 2013

Note, this did not work for me. The class throwing the error actually looks internal to AMP

[INFO] Trace
org.mozilla.javascript.EvaluatorException: Compilation produced 3 syntax errors.
        at com.atlassian.maven.plugins.amps.util.minifier.YUIErrorReporter.runtimeError(YUIErrorReporter.java:35)
        at org.mozilla.javascript.Parser.parse(Parser.java:392)
        at org.mozilla.javascript.Parser.parse(Parser.java:337)
        at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:312)
        at com.yahoo.platform.yui.compressor.JavaScriptCompressor.&lt;init&gt;(JavaScriptCompressor.java:533)
        at com.atlassian.maven.plugins.amps.util.minifier.ResourcesMinifier.yuiJsCompile(ResourcesMinifier.java:156)
        at com.atlassian.maven.plugins.amps.util.minifier.ResourcesMinifier.processJs(ResourcesMinifier.java:98)

0 votes
samikallio February 9, 2017

This is somewhat old question, but I post my answer here for anyone struggling this issue with JIRA 7. For me worked setting compressResources to false in maven-amps-plugin, like so:

&lt;plugin&gt;
	&lt;groupId&gt;com.atlassian.maven.plugins&lt;/groupId&gt;
    &lt;artifactId&gt;maven-amps-plugin&lt;/artifactId&gt;
    &lt;extensions&gt;true&lt;/extensions&gt;
		&lt;configuration&gt;
   			&lt;compressResources&gt;false&lt;/compressResources&gt;
		&lt;/configuration&gt;
&lt;/plugin&gt;

 

 

EddieW
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 27, 2017

Duplicate answer. Vote for existing instead please.

0 votes
Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 12, 2013
0 votes
Viðar Svansson [Tempo]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 6, 2013

Does anyone know why AMPS is producing these errors. We have developers with AMPS 4.1.x and they can't run atlas-package because of YUI errors but it works fine on AMPS 3.10-3.11.

0 votes
EddieW
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 19, 2013

Voting for this question and the issue Joseph linked to. Does anyone have _any_ work around to at least allow me to host some resource files with my plugin? The syntax warnings I get don't help me track down a cause I can fix.

0 votes
MattS
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 21, 2011
MattS
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 21, 2011

Actually that bug mentions a property atlassian.webresource.disable.minification
which you might be able to pass into the Java compile plugin?

Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 21, 2011

atlassian.webresource.disable.minification is a system property of the hosting application that determines whether or not the plugin framework looks for minified files before serving the requested resource.

Unfortunately it does not control whether or not the Plugin SDK actually generates the minified files in the first place.

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 21, 2011

@Joseph: what does?

Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 25, 2011

I think that's the million dollar question!

Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 1, 2012

This came up again internally, no-one I've asked knows how to do this. For posterity, I've created https://ecosystem.atlassian.net/browse/AMPS-796 in the hopes that we can find an answer eventually.

Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 26, 2013

And eventually, the real answer. Thanks to Igor for finding this, and to Eddie for testing out and confirming: https://ecosystem.atlassian.net/browse/AMPS-796?focusedCommentId=96080&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-96080

0 votes
MattS
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 19, 2011

From https://www.adaptavist.com/display/~jmort/2011/02/09/Advanced+Atlassian+Plugin+SDK I'd try something like this:

<project>
  <properties> 
    <atlassian.dev.mode>false</atlassian.dev.mode> 
    <atlassian.webresource.disable.minification>true</atlassian.webresource.disable.minification>
  </properties> 
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 20, 2011

Hrm thanks, but that didn't work. The linked page leads me to believe that those are system properties passed to jira for when you do atlas-run - ie disable serving the minified files at runtime.

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 20, 2011

The odd thing is when I do help:effective-pom I'd expect to see where this being called from, but I don't.

EddieW
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 19, 2013

Didn't work for me either, but Igor's answer did (extention=true, compress=false)

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events