Archiva with MySQL

1) Create the database spaces on the mysql side.
2) Create the users on the mysql side
3) Assign the permissions to those database spaces on for those users.
4) Configure your jndi sources.
5) Use an appropriate mysql jdbc connector.
6) Use the appropriate jdbc driver (there are 4 valid drivers within the mysql jdbc connector, you need to choose the one most appropriate to your environment)

Other option:
Check out archiva's webapp, there's a -Pmysql profile that you can use with jetty:run to execute archiva entirely on mysql.

The archiva-webapp/src/jetty-env-mysql.xml (This is actually a jetty configuration file) has some details on how to prep (or bootstrap) mysql so that you can have jpox create the tables and indexes for you.

Tomcat Specifics.

  • If you want to use a MySQL database in UTF-8 format, please refer to MRM-227
  • Add the JDBC Driver type 4 for MySQL.
  • Set up your datasources. For example in tomcat :
<Context path="/archiva" 
         docBase="E:/OSS/m2-trunks/archiva/archiva-webapp/target/archiva-webapp-1.0-SNAPSHOT.war" 
         reloadable="true" 
         antiJARLocking="true" 
         antiResourceLocking="true">

  <Resource name="jdbc/users" 
            auth="Container" 
            type="javax.sql.DataSource" 
            username="users" 
            password="users" 
            driverClassName="com.mysql.jdbc.Driver" 
            url="jdbc:mysql://localhost:3306/users?autoReconnect=true"/>

  <Resource name="jdbc/archiva" 
            auth="Container" 
            type="javax.sql.DataSource" 
            username="archiva" 
            password="archiva" 
            driverClassName="com.mysql.jdbc.Driver" 
            url="jdbc:mysql://localhost:3306/archiva?autoReconnect=true"/>

  <Resource name="mail/Session" 
            auth="Container" 
            type="javax.mail.Session" 
            mail.smtp.host="localhost"/>
</Context>

References

  • No labels