Suddenly, syntax errors occur whenever packaging is performed

Hello everyone.

Sources that were previously built without problems through atlas-package have recently caused syntax errors.

This is an add-on for Datacenter Jira.

Here is the error syntax:

atlas-package
[INFO] Project POM found
[INFO] Resolving plugin info, may take a while on the first run.
[INFO] Project defined AMPS version detected: 8.0.1
Executing: /opt/homebrew/Cellar/atlassian-plugin-sdk/8.2.7/libexec/apache-maven-3.5.4/bin/mvn package -gs /opt/homebrew/Cellar/atlassian-plugin-sdk/8.2.7/libexec/apache-maven-3.5.4/conf/settings.xml
[INFO] Scanning for projects...
[INFO]
[INFO] --------------< kr.osci.atlas.customapps:sscard-jira-sso >--------------
[INFO] Building sscard-jira-sso 1.0.1
[INFO] --------------------------[ atlassian-plugin ]--------------------------
[WARNING] The artifact jta:jta:jar:1.0.1b has been relocated to javax.transaction:jta:jar:1.0.1B
[INFO]
[INFO] --- jira-maven-plugin:8.0.1:compress-resources (default-compress-resources) @ sscard-jira-sso ---
[INFO] Compiling javascript using YUI
[ERROR] missing ) after argument list
	    return new Promise(async function(resolve, reject) {
[ERROR] missing ; before statement
	        let msg = await flexibleUserLicesneCheck(checkUrl);
[ERROR] missing ; before statement
	        let validFlag = false;
[ERROR] missing ; before statement
	            let successMsg = {
[ERROR] syntax error
	                type: 'success',
[ERROR] syntax error
	                body: 'Flexible User License๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ์„ค์น˜๋˜์–ด์žˆ์Šต๋‹ˆ๋‹ค.',
[ERROR] syntax error
	                close: 'auto'
[ERROR] missing ; before statement
	            let errorMsg = {
[ERROR] syntax error
	                type: 'error',
[ERROR] syntax error
	                body: 'Flexible User License๊ฐ€ ์„ค์น˜๋˜์–ด ์žˆ์ง€ ์•Š์Šต๋‹ˆ๋‹ค.',
[ERROR] syntax error
	                close: 'auto'
[ERROR] syntax error
	    })
[ERROR] missing ) after argument list
	    return new Promise(async function(resolve, reject) {
[ERROR] missing ; before statement
	        let entity = await getActiveSsoEntity();
[ERROR] missing ; before statement
	        let flag = entity.activeFlag;
[ERROR] syntax error
	    })
[ERROR] missing ) after argument list
	    return new Promise(async function(resolve, reject) {
[ERROR] missing ; before statement
	        let entity = await getActiveSsoEntity();
[ERROR] missing ; before statement
	                let successMsg = {
[ERROR] syntax error
	                    type: 'success',
[ERROR] syntax error
	                    body: 'Flexible User License ์„ค์ •์ด ์ •์ƒ์ ์œผ๋กœ ์ €์žฅ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.',
[ERROR] syntax error
	                    close: 'auto'
[ERROR] missing ; before statement
	                let errorMsg = {
[ERROR] syntax error
	                    type: 'error',
[ERROR] syntax error
	                    body: 'Flexible User License ์„ค์ •์ด ์ •์ƒ์ ์œผ๋กœ ์ €์žฅ๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.',
[ERROR] syntax error
	                    close: 'auto'
[ERROR] syntax error
	    })
[ERROR] missing ; before statement
	                let errorMsg = {
[ERROR] syntax error
	                    type: 'error',
[ERROR] syntax error
	                    body: 'Flexible User License๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ์„ค์น˜๋˜์–ด ์žˆ์ง€ ์•Š์Šต๋‹ˆ๋‹ค.',
[ERROR] syntax error
	                    close: 'auto'
[ERROR] Compilation produced 31 syntax errors.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.130 s
[INFO] Finished at: 2023-10-19T16:49:56+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.atlassian.maven.plugins:jira-maven-plugin:8.0.1:compress-resources (default-compress-resources) on project sscard-jira-sso: Execution default-compress-resources of goal com.atlassian.maven.plugins:jira-maven-plugin:8.0.1:compress-resources failed: Compilation produced 31 syntax errors. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

If anyone can help, I would really appreciate it.

Newer syntax is just not supported by YUI compressor and it fails in non-deterministic ways AFAIK. The rule of thumb is if you use tools like Webpack or if youโ€™re using newer syntax like Arrow Symbols then you should not use YUI compressor. Thereโ€™s not much out there officially about this but thereโ€™s old posts like this : How to Compress ES6 files with maven for an Jira P...

1 Like

Thank you for answer.
If you use the promise await function, a syntax error will occur.
I first changed this problem to a callback method, but can you recommend a better method?

You should probably use frontend-maven-plugin in your POM and transpile your code to whatever version of EcmaScript is supported, or minify it without YUI (there are plenty oftools that you can use: Webpack, Viteโ€ฆ).
You can also set <compressResources> to false to just skip the YUI compressor step: any modern browser will support promises, thereโ€™s no reason to go back to the dark days of callbacks :slight_smile:

1 Like