How to Compress ES6 files with maven for an Jira Plugin

Chris Langenberg June 8, 2017

Hi,

I have an ES6 compliant JS file, which I am trying to include in my Jira Plugin. unfortunately, when i run atlas-package the following error occurs.

 

[INFO] --- maven-amps-plugin:6.3.1:compress-resources (default-compress-resources) @ risk-management ---
[INFO] Compiling javascript using YUI
[ERROR] syntax error
AJS.toInit($ => {

[ERROR] Compilation produced 1 syntax errors.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.311 s
[INFO] Finished at: 2017-06-08T14:44:42+01:00
[INFO] Final Memory: 39M/300M
[INFO] ------------------------------------------------------------------------

 

I tried to insert this Code snippet in the Chrome console and it just works like a charm. Is there a way to use ES6 or do i have to use the old ways of JS?

1 answer

2 votes
Daniel August 27, 2017

After some search I came to conclusion that using

<compressResources>false</compressResources>

option in maven-amps-plugin configuration is the only way right now. 

amps plugin comes with yuicompressor v2.4.7 from ancient 2012's

for JS compression you can use any other plugin or just don't use compression.

Sergi Dehesa December 9, 2019

Sadly no way to use Google Closure Compiler 

Waiting for an update from Atlassian team

Chris Langenberg December 9, 2019

Actually you can, if you want to take a little detour. With the help of this maven plugin Frontend Maven Plugin you can use Node for transpiling your JS files. You just have to update your pom.xml accordingly. You could also use webpack and JS frameworks like react, angular and sorts. It takes a while to setup, but it works really well if you want to use those new Technologies.

Like Sergi Dehesa likes this
Aymen Maamri June 21, 2020

hello Chris,

i also want to use ES6 in my Plugin development,i only want the code to compile,i have no need to another Framework,so as i understand i have to add the dependency to my pom file,is there any special configuration i have to do ? 

Suggest an answer

Log in or Sign up to answer