Find Questions…

Close ×
First time here? Check out the FAQ!

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

Jamie Echlin asked this question · 48,581 karma ·

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

2189 views

Eddie Webb · 5,208 karma ·

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.

Viðar Svansson [Tempo] · 2,173 karma ·

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.

Joseph Clark [Atlassian] · 21,940 karma ·

4 Answers:

Igor Sereda · 4,292 karma ·

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 · 4,292 karma ·

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

Jamie Echlin · 48,581 karma ·

doesn't work either!

with extensions: false I get:

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

Igor Sereda · 4,292 karma ·

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 [Bob Swift Add-ons, an Appfire company] · 23,907 karma ·

<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.

·3 users liked this

Eddie Webb · 5,208 karma ·

Hey alright! This worked for me on confluence!

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

·3 users liked this

Kinto Soft · 66 karma ·

+1 for the Igor's answer.

·1 user liked this

Pascal Charbonneau · 85 karma ·

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 :)

Adrien Ragot [Atlassian] · 191 karma ·

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>

Eddie Webb · 5,208 karma ·

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.<init>(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)

Matt Doar (ServiceRocket) · 5,562 karma ·

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> 

Jamie Echlin · 48,581 karma ·

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.

Jamie Echlin · 48,581 karma ·

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

Eddie Webb · 5,208 karma ·

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

Matt Doar (ServiceRocket) · 5,562 karma ·

You could vote for https://jira.atlassian.com/browse/JRA-24964

Matt Doar (ServiceRocket) · 5,562 karma ·

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

Joseph Clark [Atlassian] · 21,940 karma ·

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.

Jamie Echlin · 48,581 karma ·

@Joseph: what does?

Joseph Clark [Atlassian] · 21,940 karma ·

I think that's the million dollar question!

·1 user liked this

Joseph Clark [Atlassian] · 21,940 karma ·

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.

Joseph Clark [Atlassian] · 21,940 karma ·

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

Looking for something else?

Find Questions…

or Browse other questions tagged:

or Ask a Question