1

I'm developing a confluence plugin and I'm using bower as my package manager. When I try to compile and package the plugin the SDK tries to minify all the JS files using YUI compressor.

The minification process fails due to various reasons (reserved words, syntax errors), all caused by the packages installed by bower.

When I don't minify the code everything passes, and the plugin works fine. I tried atlas-compile --fail-never, didn't help.

Any idea on how I can minify the code without having to modify the packages code? Or maybe put a flag that will cause only the files that are in atlassian-plugin.xml to be minified?

Thanks!

Yaron Schwimmer
  • 5,327
  • 5
  • 36
  • 59

2 Answers2

2

In the pom.xml, ensure that you don't compress JS with <compressResources>false</compressResources> e.g. around here...

  <build>
      ...
      <plugin>
            <groupId>com.atlassian.maven.plugins</groupId>
            <artifactId>maven-confluence-plugin</artifactId>
            <version>${amps.version}</version>
            <extensions>true</extensions>
            <configuration>
                   ...
                   <compressResources>false</compressResources>
                   ...
            </configuration>
      </plugin>
      ...
dvdsmpsn
  • 2,839
  • 1
  • 26
  • 40
  • 1
    But then my code will not be minified. I want the minification, but I don't want the compressor to minify *all* the JS files in my resources folder. Just the ones I use. – Yaron Schwimmer Jan 05 '15 at 08:05
1

I am trying to solve the same issue and I came to believe this is not possible. (It's 2016, people. This is not rocket science.)

The error I am getting is:

[INFO] --- maven-confluence-plugin:6.2.4:compress-resources (default-compress-resources) @ confluence-tagging ---

[INFO] Compiling javascript using YUI

[ERROR] illegal character

And then errors in some file deep in node_modules that should definitely not be included in the plugin build.

I tried to list all available options for the compressor plugin using this command:

atlas-mvn help:describe -Dplugin=com.atlassian.maven.plugins:maven-confluence-plugin -Dgoal=compress-resources -Ddetail=true

The list says that there is no such option. I tried to configure it to use Closure Compiler instead, but it did not help much. The configuration is this:

<plugin>
    <groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>maven-confluence-plugin</artifactId>
    <executions>
        <execution>
            <goals>
                <goal>compress-resources</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <closureJsCompiler>true</closureJsCompiler>
    </configuration>
</plugin>

Which just gives me even longer list of errors.

At this point, I am giving up.

Here are some relevant links:

https://developer.atlassian.com/docs/advanced-topics/supporting-minification-of-javascript-and-css-resources - desperately outdated

https://answers.atlassian.com/questions/221949/how-to-select-which-resources-are-compressed

Community
  • 1
  • 1
Corkscreewe
  • 2,921
  • 2
  • 22
  • 23