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

Confluence SDK, How to connect Confluence to MySQL instead of In memory db?

RikuK March 13, 2014

Hi,

i need to connect Confluence SDK version to mysql, so that i can test plugins in production alike environment. Web is full of tutorials for JIRA and i have connected JIRA to mysql, but there is no tutorials for Confluence. Key point in this, is the fact, that i am using SDK, not standalone.

So, how can i change Confluence sdk to use MySQL instead of in memory database?

-Riku

8 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Adrien Ragot 2
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.
March 13, 2014

You can start with an empty home directory, so Confluence will let you go through the setup. You'll need to grab a developer license from my.atlassian.com.

As a bonus, you can define a JNDI datasource so you don't have to enter the passwords. Here's the excerpt of my pom.xml:

<build>
    <plugins>
      <plugin>
        <groupId>com.atlassian.maven.plugins</groupId>
        <artifactId>maven-amps-plugin</artifactId>
        <version>4.1</version>
        <extensions>true</extensions>
        <configuration>
          <installPlugin>${install.plugin}</installPlugin>
          <enableFastdev>false</enableFastdev>
          <instanceId>confluence</instanceId>
          <parallel>true</parallel>
          <products>
            <product>
              <id>confluence</id>
              <instanceId>confluence</instanceId>
              <version>${confluence.version}</version>
              <dataPath>${project.build.path}/empty</dataPath>
              <jvmArgs>-Xmx512m -XX:MaxPermSize=512m -Xms128m</jvmArgs>
              <systemPropertyVariables>
                <atlassian.dev.mode>${atlassian.dev.mode}</atlassian.dev.mode>
              </systemPropertyVariables>

              <dataSources>
                <dataSource>
                      <jndi>jdbc/DefaultDS</jndi>
                      <url>jdbc:mysql://192.168.1.61:3306/test</url>
                      <driver>com.mysql.jdbc.Driver</driver>
                      <username>test</username>
                      <password>test</password>
                      <libArtifacts>
                          <libArtifact>
                                <groupId>mysql</groupId>
                                <artifactId>mysql-connector-java</artifactId>
                                <version>5.1.11</version>
                            </libArtifact>
                      </libArtifacts>
                </dataSource>
              </dataSources>
            </product>
          </products>
        </configuration>
      </plugin>

RikuK March 16, 2014

Thank you! I selected this as an answer, because you mentioned deleting home folder. After deleting contents of target/confluence/home i started confluence normally with atlas-run and setup started. With that, it was dead simple to get MySQL to work.

Riaz October 29, 2014

Hi Riku, Please explain the solution that you got for your requirements. I am also looking for the same.

1 vote
Steve Gerstner [bridgingIT]
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.
March 13, 2014

1. You can use maven directly and use a local instance of confluence as the sdk is only a wrapper for maven -> https://developer.atlassian.com/display/DOCS/Using+the+AMPS+Maven+Plugin+Directly

2. You can use a standalone installation of confluence with the sdk by specifying the right parameters. Take the install-plugin command as an example. -> https://developer.atlassian.com/display/DOCS/atlas-install-plugin

RikuK March 16, 2014

Never realised the fact, that it's just a wrapper. First link's content should be first thing to show, when introducing someone to plugin development! Thank you!

Adrien Ragot 2
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.
March 16, 2014

The SDK designers assumed that configuring the Maven version and the Atlassian repositories was hard and it was better to wrap it. They've left enough hints so Maven ninjas could discover how to call Maven directly. If you're looking for the syntax of the pom.xml or command-line parameters, here's the source (the *Mojo.java are the goals). I'm a big fan of that SDK so if you have more questions I'm (we are?) happy to answer them ;)

0 votes
Riaz November 11, 2014

when I used atlas-run, the confluence was created automatically to test the plugin, that time when I changed the "css" codes, it was reflected dynamically in the running application, so i could test it easily.

But now after  using atlas-mvn confluence:run to use my external sqlserver database, I could not test the plugin dynamically by changing the CSS codes. It is not getting reflected in the running application immediately.

I tried flushing the cache, but no use.  

Am I missing anything here ?

0 votes
Riaz November 10, 2014
Worked after using the below dependency...

 

<!-- MS SQL JDBC Driver -->
        <dependency>
            <groupId>net.sourceforge.jtds</groupId>
            <artifactId>jtds</artifactId>
            <version>1.2.2</version>
        </dependency>
0 votes
Riaz October 31, 2014

I followed all the guidelines properly but

I get the below error when i execute "atlas-mvn confluence:run" or  "atlas-mvn amps:run"

 

[ERROR] The project com.example.plugins.tutorial.confluence:theme-tutorial:1.0
-SNAPSHOT (C:\Users\Riaz\atlastutorial\theme-tutorial\pom.xml) has 1 error
[ERROR] 'dependencies.dependency.version' for com.microsoft.sqlserver:sqljdb
c:jar must be a valid version but is '${sqljdbc.libversion}'. @ line 50, column
23
[ERROR]

 

===========================

so this is the code......

<dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>sqljdbc</artifactId>
             <version>${sqljdbc.libversion}</version>
            <scope>provided</scope>
        </dependency>

 

i tried giving 1.2.2 instead of "${sqljdbc.libversion}", but no use, same error.

 

whats wrong here....

 

0 votes
Steve Gerstner [bridgingIT]
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 30, 2014

In theory, you can run your own confluenceserver which is using mysql and configure your maven via parameters so that the plugin is not using the bundled confluence but your standalone server. The problem here will be that it's poorly till not documentet...

0 votes
Riaz October 29, 2014

Please anybody explain how to handle this kind of situation ....

in a step by step procedure ...........

Should I follow only the below documentations ?

Using the AMPS Maven Plugin Directly ,

AMPS Build Configuration Reference

Declaring JNDI Datasources in AMPS

 

what about just "atlas-run" and changing pom.xml ?

 

@Riku Koskinen 

How did you get this done ?

please explain.

Adrien Ragot 2
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 29, 2014

Did you try using the excerpt of pom.xml that I provided above? What worked? What didn't work? I suggest you write a separate question for your own problem.

Riaz October 30, 2014

when i execute this .... C:\Users\Riaz\atlastutorial>mvn confluence:create i get the below error... mvn confluence:create 'mvn' is not recognized as an internal or external command, operable program or batch file.

Riaz October 30, 2014

So i executed like the below .... C:\Users\Riaz\atlastutorial>atlas-mvn confluence:create it created a plugin folder called "theme-tutorial" i opened the pom.xml and i changed like the below file.... ---------------------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">; <modelVersion>4.0.0</modelVersion> <groupId>com.example.plugins.tutorial.confluence</groupId> <artifactId>theme-tutorial</artifactId> <version>1.0-SNAPSHOT</version> <organization> <name>Example Company</name> <url>http://www.example.com/</url>; </organization> <name>theme-tutorial</name> <description>This is the com.example.plugins.tutorial.confluence:theme-tutorial plugin for Atlassian Confluence.</description> <packaging>atlassian-plugin</packaging> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.10</version> <scope>test</scope> </dependency> <dependency> <groupId>com.atlassian.confluence</groupId> <artifactId>confluence</artifactId> <version>${confluence.version}</version> <scope>provided</scope> </dependency> <!-- WIRED TEST RUNNER DEPENDENCIES --> <dependency> <groupId>com.atlassian.plugins</groupId> <artifactId>atlassian-plugins-osgi-testrunner</artifactId> <version>${plugin.testrunner.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>javax.ws.rs</groupId> <artifactId>jsr311-api</artifactId> <version>1.1.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.2.2-atlassian-1</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>com.atlassian.maven.plugins</groupId> <artifactId>maven-confluence-plugin</artifactId> <version>${amps.version}</version> <extensions>true</extensions> <configuration> <productVersion>${confluence.version}</productVersion> <productDataVersion>${confluence.data.version}</productDataVersion> <products> <product> <id>confluence</id> <instanceId>instanceId1</instanceId> <version>${confluence.version}</version> <dataPath>src/main/resources/empty-home</dataPath> <dataSources> <dataSource> <jndi>jdbc/DefaultDS</jndi> <url>jdbc:jtds:sqlserver://localhost:1433/saevconf</url> <username>username</username> <password>password</password> <driver>net.sourceforge.jtds.jdbc.Driver</driver> <libArtifacts> <libArtifact> <groupId>com.microsoft.sqlserver</groupId> <artifactId>sqljdbc</artifactId> <version>${sqljdbc.libversion}</version> </libArtifact> </libArtifacts> </dataSource> </dataSources> </product> </products> </configuration> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build> <properties> <confluence.version>5.6.4</confluence.version> <confluence.data.version>5.6.4</confluence.data.version> <amps.version>5.0.8</amps.version> <plugin.testrunner.version>1.2.3</plugin.testrunner.version> </properties> </project> ------------------------------------------------------------------------ and then i executed the below command... C:\Users\Riaz\atlastutorial>atlas-mvn confluence:run i checked the localhost:1990/confluence i does not use the provided mssqlserver database... i want to use sqlserver database... kindlyadvice, whats wrong here

Adrien Ragot 2
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 30, 2014

* Did you create an empty folder at src/main/resources/empty-home ? * I've made the demonstration with "maven-amps-plugin" and I'm not sure how it works with "maven-confluence-plugin". So you can 1. replace maven-confluence-plugin with maven-amps-plugin, 2. add an <instanceId> with the same ID as in the <products> tag, 3. run "atlas-mvn amps:run" instead, and it should work. There's probably a way to make it work with maven-confluence-plugin but it requires investigating a little bit. There will be one last step: In your <dependencies>, you need to repeat the driver's definition: <dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>sqljdbc</artifactId> <version>${sqljdbc.libversion}</version> <scope>provided</scope> </dependency>

Riaz October 30, 2014

no, i did not create the empty folder. should i create an empty home folder inside C:\Users\Riaz\atlastutorial\theme-tutorial\src\main\resources ? whats the purpose of it ? is the below command correct if my home folder is "C:\Users\Riaz\atlastutorial\theme-tutorial\src\main\resources\home" like this ? " C:\Users\Riaz\atlastutorial>atlas-mvn amps:run "

Adrien Ragot 2
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 30, 2014

Yes to both your questions. The purpose of the empty folder is, we're telling the SDK to copy <dataPath> to create the data directory. If <dataPath> is not specified, it uses the <dataVersion> number, downloads it from Atlassian, and deploys a pre-installed version of Confluence. If you provide the empty directory instead, it will start with an empty data directory, so you will have the opportunity of going through the setup wizard.

Riaz October 31, 2014

<dataPath>${project.build.path}/empty</dataPath> I tried with the above <dataPath> as you mentioned in your pom.xml but i get the following error... [ERROR] Failed to execute goal com.atlassian.maven.plugins:maven-confluence-plug in:5.0.8:run (default-cli) on project theme-tutorial: Unable to use custom test resources set by <dataPath>. File 'C:\Users\Riaz\atlastutorial\theme-tutorial\${ project.build.path}\empty' does not exist -> [Help 1] [ERROR] My folder structure is as follows... C:\Users\Riaz\atlastutorial\theme-tutorial\src\main\resources\home

0 votes
Riaz October 29, 2014

Please anybody explain how to handle this kind of situation .... in a step by step procedure ...........

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events