Problem with compressResources and Tabs using AUI

We’re currently using Confluence 6.15.2

When we include aui CSS in mobile context it works with the maven-parameter:

<compressResources>false</compressResources>

However it does not work with:

<compressResources>true</compressResources>

See here:
image001

Why is this striped? Is there a way to use “compressResources” without changing the Look&Feel?!

Hi @Noragen!

I’d like to know a little more about what you’re doing and what other output you’re seeing.

How are you consuming AUI’s CSS styles? Are you attempting to compile AUI’s CSS yourself? My understanding of compressResources is that it is taking all the files in your src/main/resources directory and running minification on them. If you are compiling them, I would expect to see some messages in the maven build output. Are you able to show us those build logs? Are there any errors in there?

Secondly, can you provide us with the contents of the atlassian-plugin.xml file that’s output to your target/classes folder, from when compressResources is both true and false? That file will include in it some metadata about the files that the plugin system should be loading.

Finally, are you able to confirm that the physical CSS files in your target/classes directory contain any CSS code?

I suspect that there is a problem somewhere in the building of your plugin, but we will need to see build logs to narrow in on the problem.

Cheers,
Daz

Hello Daz,

following part of our atlassian-plugin.xml is responsible for our “Tabs”.

<!-- Tabs Macro -->
	<xhtml-macro key="vw-tabs" name="vw-tabs"
		class="${project.groupId}.TabsMacro" documentation-url="${vw.doc.path}/GW Tabs Makro"
		icon="/download/resources/${project.groupId}.${project.artifactId}/images/tabs-logo.png">
		<description key="${project.groupId}.${project.artifactId}.vw-tabs.desc" />
		<category name="formatting" />
		<device-type>mobile</device-type>
		<parameters>
			<parameter name="active-tab-index" type="string" default="0" />
			<parameter name="orientation" type="enum" default="horizontal">
				<value name="horizontal" />
				<value name="vertical" />
			</parameter>
			<parameter name="languages" type="string" default="none" />
			<parameter name="userLanguageEnabled" type="boolean" />
		</parameters>
	</xhtml-macro>

	<web-resource key="tabs-desktop-resources" name="tabs-desktop-resources">
		<transformation extension="js">
			<transformer key="jsI18n" />
		</transformation>
		<transformation extension="soy">
			<transformer key="soyTransformer" />
		</transformation>
		<resource type="download" name="tabs.css" location="/css/tabs.css" />
		<resource type="download" name="tabs-soy.js" location="/soy/tabs.soy" />
		<resource type="download" name="tabs.js" location="js/tabs.js" />
		<resource type="download" name="tabs-desktop.js" location="js/tabs-desktop.js" />
		<context>atl.confluence.macros.vw-tabs.desktop</context>
	</web-resource>

	<web-resource key="tabs-mobile-resources" name="tabs-mobile-resources">
		<transformation extension="js">
			<transformer key="jsI18n" />
		</transformation>
		<transformation extension="soy">
			<transformer key="soyTransformer" />
		</transformation>
		<resource type="download" name="theme-mobile.css" location="/css/theme-mobile.css" />
		<resource type="download" name="tabs-soy.js" location="/soy/tabs.soy" />
		<resource type="download" name="tabs.css" location="/css/tabs.css" />
		<resource type="download" name="tabs.js" location="js/tabs.js" />
		<resource type="download" name="tabs-mobile.js" location="js/tabs-mobile.js" />

		<resource type="download" name="VWAGTheAntiqua-Regular.woff" location="/fonts/VWAGTheAntiqua-Regular.woff" />
		<resource type="download" name="VWAGTheSans-Regular.woff"    location="/fonts/VWAGTheSans-Regular.woff" />

		<!--<dependency>com.atlassian.auiplugin:ajs</dependency>--><!--Necessary because of its css-->
		<dependency>com.atlassian.auiplugin:jquery-all</dependency>
		<dependency>com.atlassian.auiplugin:aui-tabs</dependency>
		<dependency>com.atlassian.auiplugin:aui-navigation</dependency>
		<context>atl.confluence.macros.vw-tabs.mobile</context>
	</web-resource>

and then we have following maven pom.xml-part:

...
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-confluence-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <compressResources>false</compressResources><!-- !!!! needs to be switched off, because there is an issue with GW-Tabs not rendered correctly mobile, when switched on !!!! -->
                    <productVersion>${confluence.version}</productVersion>
                    <productDataVersion>${confluence.data.version}</productDataVersion>
                </configuration>
            </plugin>
...

The css is there in target/classes. Thats not the problem. I think more that compressResources seems to be used in a double way.

If you need some more info about the tabs-implementation, please let me know.
I’m going to provide some build-logs below.

Best regards
Tobias Franz


compressResources=false

C:\Anaconda3\Library\bin\java.exe -Dmaven.home=C:\atlassian-plugin-sdk-6.3.12\apache-maven-3.2.1 -Dclassworlds.conf=C:\atlassian-plugin-sdk-6.3.12\apache-maven-3.2.1\bin\m2.conf "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2018.3.4\lib\idea_rt.jar=64603:C:\Program Files\JetBrains\IntelliJ IDEA 2018.3.4\bin" -Dfile.encoding=UTF-8 -classpath C:\atlassian-plugin-sdk-6.3.12\apache-maven-3.2.1\boot\plexus-classworlds-2.5.1.jar org.codehaus.classworlds.Launcher -Didea.version2019.1.3 -s C:\atlassian-plugin-sdk-6.3.12\apache-maven-3.2.1\conf\settings.xml -DskipTests=true clean package
[INFO] Scanning for projects...
[INFO] 
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building GW Base Macros Plugin 7.15.17
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ vw-base-macros-plugin ---
[INFO] Deleting C:\projects\CTOARCH\trunk\confluence-5.6.5\vw-base-macros-plugin\target
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:compress-resources (default-compress-resources) @ vw-base-macros-plugin ---
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ vw-base-macros-plugin ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 100 resources
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:filter-plugin-descriptor (default-filter-plugin-descriptor) @ vw-base-macros-plugin ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ vw-base-macros-plugin ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 39 source files to C:\projects\CTOARCH\trunk\confluence-5.6.5\vw-base-macros-plugin\target\classes
[INFO] /C:/projects/CTOARCH/trunk/confluence-5.6.5/vw-base-macros-plugin/src/main/java/de/vw/confluence/base/macros/PlatformAssembler.java: C:\projects\CTOARCH\trunk\confluence-5.6.5\vw-base-macros-plugin\src\main\java\de\vw\confluence\base\macros\PlatformAssembler.java uses unchecked or unsafe operations.
[INFO] /C:/projects/CTOARCH/trunk/confluence-5.6.5/vw-base-macros-plugin/src/main/java/de/vw/confluence/base/macros/PlatformAssembler.java: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:generate-rest-docs (default-generate-rest-docs) @ vw-base-macros-plugin ---
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ vw-base-macros-plugin ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\projects\CTOARCH\trunk\confluence-5.6.5\vw-base-macros-plugin\src\test\resources
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:filter-test-plugin-descriptor (default-filter-test-plugin-descriptor) @ vw-base-macros-plugin ---
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ vw-base-macros-plugin ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:unit-test (default-unit-test) @ vw-base-macros-plugin ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:copy-bundled-dependencies (default-copy-bundled-dependencies) @ vw-base-macros-plugin ---
[INFO] Unpacking C:\Users\tfz\.m2\repository\de\vw\utils\vw-utils\2.4.0\vw-utils-2.4.0.jar to C:\projects\CTOARCH\trunk\confluence-5.6.5\vw-base-macros-plugin\target\classes with includes "" and excludes "atlassian-plugin.xml,META-INF/MANIFEST.MF,META-INF/*.DSA,META-INF/*.SF"
[INFO] Unpacking C:\Users\tfz\.m2\repository\com\google\code\gson\gson\2.8.2\gson-2.8.2.jar to C:\projects\CTOARCH\trunk\confluence-5.6.5\vw-base-macros-plugin\target\classes with includes "" and excludes "atlassian-plugin.xml,META-INF/MANIFEST.MF,META-INF/*.DSA,META-INF/*.SF"
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:copy-test-bundled-dependencies (default-copy-test-bundled-dependencies) @ vw-base-macros-plugin ---
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:generate-manifest (default-generate-manifest) @ vw-base-macros-plugin ---
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:generate-test-manifest (default-generate-test-manifest) @ vw-base-macros-plugin ---
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:validate-manifest (default-validate-manifest) @ vw-base-macros-plugin ---
[INFO] Manifest found, validating...
[INFO] Manifest validated
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:jar (default-jar) @ vw-base-macros-plugin ---
[INFO] Building jar: C:\projects\CTOARCH\trunk\confluence-5.6.5\vw-base-macros-plugin\target\gw-base-macros-plugin-7.15.17.jar
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:generate-obr-artifact (default-generate-obr-artifact) @ vw-base-macros-plugin ---
[INFO] Skipping OBR generation... no OSGi bundle manifest instructions found in pom.xml
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:validate-test-manifest (default-validate-test-manifest) @ vw-base-macros-plugin ---
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:test-jar (default-test-jar) @ vw-base-macros-plugin ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 59.833 s
[INFO] Finished at: 2019-06-05T14:45:00+01:00
[INFO] Final Memory: 65M/560M
[INFO] ------------------------------------------------------------------------

Process finished with exit code 0

compressResources=true:

C:\Anaconda3\Library\bin\java.exe -Dmaven.home=C:\atlassian-plugin-sdk-6.3.12\apache-maven-3.2.1 -Dclassworlds.conf=C:\atlassian-plugin-sdk-6.3.12\apache-maven-3.2.1\bin\m2.conf "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2018.3.4\lib\idea_rt.jar=64652:C:\Program Files\JetBrains\IntelliJ IDEA 2018.3.4\bin" -Dfile.encoding=UTF-8 -classpath C:\atlassian-plugin-sdk-6.3.12\apache-maven-3.2.1\boot\plexus-classworlds-2.5.1.jar org.codehaus.classworlds.Launcher -Didea.version2019.1.3 -s C:\atlassian-plugin-sdk-6.3.12\apache-maven-3.2.1\conf\settings.xml -DskipTests=true clean package
[INFO] Scanning for projects...
[INFO] 
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building GW Base Macros Plugin 7.15.17
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ vw-base-macros-plugin ---
[INFO] Deleting C:\projects\CTOARCH\trunk\confluence-5.6.5\vw-base-macros-plugin\target
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:compress-resources (default-compress-resources) @ vw-base-macros-plugin ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling javascript using YUI
[INFO] 23 Javascript file(s) were minified into target directory C:\projects\CTOARCH\trunk\confluence-5.6.5\vw-base-macros-plugin\target\classes
[INFO] 14 CSS file(s) were minified into target directory C:\projects\CTOARCH\trunk\confluence-5.6.5\vw-base-macros-plugin\target\classes
[INFO] Compressing XML files
[INFO] 1 XML file(s) were minified into target directory C:\projects\CTOARCH\trunk\confluence-5.6.5\vw-base-macros-plugin\target\classes
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ vw-base-macros-plugin ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 100 resources
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:filter-plugin-descriptor (default-filter-plugin-descriptor) @ vw-base-macros-plugin ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ vw-base-macros-plugin ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 39 source files to C:\projects\CTOARCH\trunk\confluence-5.6.5\vw-base-macros-plugin\target\classes
[INFO] /C:/projects/CTOARCH/trunk/confluence-5.6.5/vw-base-macros-plugin/src/main/java/de/vw/confluence/base/macros/PlatformAssembler.java: C:\projects\CTOARCH\trunk\confluence-5.6.5\vw-base-macros-plugin\src\main\java\de\vw\confluence\base\macros\PlatformAssembler.java uses unchecked or unsafe operations.
[INFO] /C:/projects/CTOARCH/trunk/confluence-5.6.5/vw-base-macros-plugin/src/main/java/de/vw/confluence/base/macros/PlatformAssembler.java: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:generate-rest-docs (default-generate-rest-docs) @ vw-base-macros-plugin ---
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ vw-base-macros-plugin ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\projects\CTOARCH\trunk\confluence-5.6.5\vw-base-macros-plugin\src\test\resources
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:filter-test-plugin-descriptor (default-filter-test-plugin-descriptor) @ vw-base-macros-plugin ---
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ vw-base-macros-plugin ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:unit-test (default-unit-test) @ vw-base-macros-plugin ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:copy-bundled-dependencies (default-copy-bundled-dependencies) @ vw-base-macros-plugin ---
[INFO] Unpacking C:\Users\tfz\.m2\repository\de\vw\utils\vw-utils\2.4.0\vw-utils-2.4.0.jar to C:\projects\CTOARCH\trunk\confluence-5.6.5\vw-base-macros-plugin\target\classes with includes "" and excludes "atlassian-plugin.xml,META-INF/MANIFEST.MF,META-INF/*.DSA,META-INF/*.SF"
[INFO] Unpacking C:\Users\tfz\.m2\repository\com\google\code\gson\gson\2.8.2\gson-2.8.2.jar to C:\projects\CTOARCH\trunk\confluence-5.6.5\vw-base-macros-plugin\target\classes with includes "" and excludes "atlassian-plugin.xml,META-INF/MANIFEST.MF,META-INF/*.DSA,META-INF/*.SF"
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:copy-test-bundled-dependencies (default-copy-test-bundled-dependencies) @ vw-base-macros-plugin ---
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:generate-manifest (default-generate-manifest) @ vw-base-macros-plugin ---
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:generate-test-manifest (default-generate-test-manifest) @ vw-base-macros-plugin ---
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:validate-manifest (default-validate-manifest) @ vw-base-macros-plugin ---
[INFO] Manifest found, validating...
[INFO] Manifest validated
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:jar (default-jar) @ vw-base-macros-plugin ---
[INFO] Building jar: C:\projects\CTOARCH\trunk\confluence-5.6.5\vw-base-macros-plugin\target\gw-base-macros-plugin-7.15.17.jar
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:generate-obr-artifact (default-generate-obr-artifact) @ vw-base-macros-plugin ---
[INFO] Skipping OBR generation... no OSGi bundle manifest instructions found in pom.xml
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:validate-test-manifest (default-validate-test-manifest) @ vw-base-macros-plugin ---
[INFO] 
[INFO] --- maven-confluence-plugin:6.3.21:test-jar (default-test-jar) @ vw-base-macros-plugin ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.742 s
[INFO] Finished at: 2019-06-05T14:49:55+01:00
[INFO] Final Memory: 83M/540M
[INFO] ------------------------------------------------------------------------

Process finished with exit code 0

I think there might be 2 possible problems here:

  1. Compression is generating invalid javascript, which is causing a JS error at runtime, and the browser is halting the execution of subsequent code in that JS file, which means the tabs aren’t getting created.
  2. The CSS is getting minified in such a way that the specificity of your rules are being beaten by the base styles.

I think (2) is unlikely, so let’s try to verify (1).

If your JS code is adding a CSS class that is required for your CSS to stick to the elements, we have a smoking gun. You can check for JS errors in your browser console; if you see any and they are in the same batch file as your code that adds a CSS class to the tabs, you’ve found the problem.

In essence, I think this is the source of your troubles:

[INFO] Compiling javascript using YUI

The default compressor in AMPS is embarrassingly old… it doesn’t understand EcmaScript 5, let alone ES6 or higher.

You can switch the compressor that AMPS runs over your javascript code by changing your config as follows:

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

If that doesn’t turn out to help, you could attempt to verify that (2) isn’t a problem by avoiding the minification of just your CSS. You can do that by adding a <compressCss>false</compressCss> to your config.

Let me know how that goes!

Cheers,
Daz

Hello,

thanx for your reply!

It turned out, that changing the compressor had no influence on the design. But compressCss had. So I think I’m going to change only this parameter at all plus enabling the standard-compressor…

For me, it seems, it looks like this is more or less intended behaviour for the mobile view by atlassian… however.

Edit: Yes, the different design came from a theme-plugin, the other one was standard-confluence-theme…

Regards Tobias