How to incluede Custom JavaScript into Confluence Plugin
Asked by Max Madjarov:

Hi,

I know this question has been asked several times... but I get nightmares already, i can't get my javascript in my Plugin. Here is resources definition in my **atlassian-plugin.xml**:

```
&lt;web-resource key="skilldatenbank.resources" name="Skilldatenbank Plugin Web Resources" &gt;        &lt;dependency&gt;com.atlassian.auiplugin:ajs&lt;/dependency&gt;        &lt;dependency&gt;confluence.web.resources:ajs&lt;/dependency&gt;        &lt;dependency&gt;confluence.web.resources:jquery&lt;/dependency&gt;                &lt;resource type="download" name="confluence-skilldatenbank-plugin.css" location="/css/confluence-skilldatenbank-plugin.css" &gt;            &lt;property key="content-type" value="text/css" /&gt;        &lt;/resource&gt;        &lt;resource type="download" name="confluence-skilldatenbank-plugin.js" location="/js/confluence-skilldatenbank-plugin.js" &gt;            &lt;property key="content-type" value="text/javascript"/&gt;        &lt;/resource&gt;        &lt;resource type="download" name="images/" location="/images"/&gt;        &lt;context&gt;atl.general&lt;/context&gt;&lt;/web-resource&gt;
```

and so i try to reference this resources in my **.vm** page.

```
#requireResource("de.twt.confluence.plugins:skilldatenbank.resources")
```

but there are neither javacsript nor styles in my page...

what is even more strange, it is not a self-defining \<script\> rendered in the template...

```
&lt;head&gt;        &lt;title&gt;$i18n.getText("catpureskills.page.title")&lt;/title&gt;        #requireResource("de.twt.confluence.plugins:skilldatenbank.resources")        &lt;script type="text/javascript"&gt;            jQuery(document).ready(function()            {                alert();            });            function fnSendAssessment(arg) {                alert(arg);            }        &lt;/script&gt;    &lt;/head&gt;
```

if i start my "plugin" with: **atlas-debug**it does't work.

Please HELP!!! :-)


Answers:
author: ConradR
body: What is your groupID and your artefactID in your pom.xml and the atlassian-plugin-key in atlassian-plugin.xml?

Maybe `"de.twt.confluence.plugins:skilldatenbank.resources"`` is wrong.`  


author: Max Madjarov
body: **pom.xml**

```
&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;&lt;groupId&gt;de.twt.confluence.plugins&lt;/groupId&gt;&lt;artifactId&gt;confluence-skilldatenbank-plugin&lt;/artifactId&gt;&lt;version&gt;1.0&lt;/version&gt;
```

**atlassian-plugin.xml**

```
&lt;atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2"&gt;    &lt;plugin-info&gt;        &lt;description&gt;${project.description}&lt;/description&gt;        &lt;version&gt;${project.version}&lt;/version&gt;        &lt;vendor name="${project.organization.name}" url="${project.organization.url}" /&gt;        &lt;param name="plugin-icon"&gt;images/pluginIcon.png&lt;/param&gt;        &lt;param name="plugin-logo"&gt;images/pluginLogo.png&lt;/param&gt;    &lt;/plugin-info&gt;
```

comments: author: ConradR
body: try

```
#requireResource("de.twt.confluence.plugins.confluence-skilldatenbank-plugin:skilldatenbank.resources")
```


author: Max Madjarov
body: Thanks, I'll try that out. Whether you know why javascript is not displayed on the page... i have included javascript in the VM Page at the header section, but it doesn't work!

```
&lt;script type="text/javascript"&gt;            jQuery(document).ready(function()            {                alert();            });            function fnSendAssessment(arg) {                alert(arg);            }&lt;/script&gt;
```


Tags: include

javascript

web-resource