Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Problem with simple Web Resource Plugin

DanielG
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 2, 2013

Hi,


I'm newby about Atlassian SDK and Jira Plugins. I want to develop a Web Resource Plugin consisting in hide a issue type on creation issue screen.

I do the next steps:

1) Install Atlassian SDK.

2) Create a new plugin skeleton.

3) Modify '/js/demo.js' in '/src/main/resources/' and put the next JavaScript code:

<script> 
jQuery(document).ready(function($) {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
        hideIssueType();
    });
     
    hideIssueType();
function hideIssueType(){
        hide();
    $("#project-field").change(function(){
        hide();        
    });        
     
}
function hide(){
        $("#issuetype option").each(function()  {              
                if($.trim($(this).text()) == 'Query'){            
                    $(this).remove();
                }
            });
 
}
 
});
</script>

4) Modify 'atlassian-plugin.xml' in '/src/main/resources' and put:

<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">
    <plugin-info>
        <description>${project.description}</description>
        <version>${project.version}</version>
        <vendor name="${project.organization.name}" url="${project.organization.url}" />
        <param name="plugin-icon">images/pluginIcon.png</param>
        <param name="plugin-logo">images/pluginLogo.png</param>
    </plugin-info>
    
    <!-- add our web resources -->
    <web-resource key="hideproject-resources" name="hideproject Web Resources">
        <dependency>com.atlassian.auiplugin:ajs</dependency>
   <resource type="download" name="hideproject.js" location="/js/hideproject.js"/>

        <context>atl.general</context>
    </web-resource>

</atlassian-plugin>

5) Try to compile with 'atlas-mvn clear package' but I got this error when compile:

[ERROR] Compilation produced 4 syntax errors.
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Compilation produced 4 syntax errors.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.mozilla.javascript.EvaluatorException: Compilation produced 4 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:228)
	at com.atlassian.maven.plugins.amps.util.minifier.ResourcesMinifier.processJs(ResourcesMinifier.java:164)
	at com.atlassian.maven.plugins.amps.util.minifier.ResourcesMinifier.processResource(ResourcesMinifier.java:61)
	at com.atlassian.maven.plugins.amps.util.minifier.ResourcesMinifier.minify(ResourcesMinifier.java:40)
	at com.atlassian.maven.plugins.amps.MavenGoals.compressResources(MavenGoals.java:504)
	at com.atlassian.maven.plugins.amps.CompressResourcesMojo.execute(CompressResourcesMojo.java:33)
	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:540)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:519)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
	at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
	at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
	at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

Any suggestion about error in my code?

Thanks in advance!!

Daniel

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 2, 2013

remove <script> </script> tags from your js file

DanielG
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 3, 2013

You have the reason! Thanks!!!

Best regards,

Daniel

TAGS
AUG Leaders

Atlassian Community Events