Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JAMES-2107 Switch to java-8 #918

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 19 additions & 30 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -82,30 +82,7 @@ Don't forget to add your key to http://www.apache.org/dist/james/KEYS

=== How to check the compilation

In order to have a standard compilation environment, we introduce Dockerfiles.
We need to check the compilation in both Java 6 & Java 8:

- Java 6 is the historical Java release used in James.
- Java 8 is used to compile the Cassandra backend.

==== Java 6

First step, you have to build the Docker image

$ docker build -t james/project dockerfiles/compilation/java-6

In order to run the build, you have to launch the following command:

$ docker run -v $PWD/.m2:/root/.m2 -v $PWD:/origin -v $PWD/dockerfiles/run/spring/destination:/destination -t james/project -s SHA1

Where:

- $PWD/.m2:/root/.m2: is the first volume used to share the maven repository,
as we don't want to download all dependencies on each build
- $PWD/dockerfiles/run/spring/destination:/destination: is the third volume used to get the compiled elements,
as it is needed by the container that will run James.
- SHA1 (optional): is the given git SHA1 of the james-project repository to build or master if none.
- -s option: given tests will not be played while building. Not specifying means play tests.
In order to have a standard compilation environment, we introduce Dockerfiles, using java-8.

==== Java 8

Expand All @@ -115,17 +92,22 @@ First step, you have to build the Docker image

In order to run the build, you have to launch the following command:

$ docker run -v $PWD/.m2:/root/.m2 -v $PWD:/origin -v $PWD/dockerfiles/run/spring/destination:/destination -t james/project -s SHA1
$ docker run -v $PWD/.m2:/root/.m2 -v $PWD:/origin -t james/project -s SHA1

Where:

- $PWD/.m2:/root/.m2: is the first volume used to share the maven repository,
as we don't want to download all dependencies on each build
- $PWD/dockerfiles/run/spring/destination:/destination: is the third volume used to get the compiled elements,
as it is needed by the container that will run James.

- SHA1 (optional): is the given git SHA1 of the james-project repository to build or master if none.
- -s option: given tests will not be played while building. Not specifying means play tests.

To retrieve compiled artifacts, one might mount these volumes:

- --volume $PWD/dockerfiles/run/spring/destination:/spring/destination : is the volume used to get the compiled elements for Spring packaging.
- --volume $PWD/dockerfiles/run/guice/cassandra/destination:/cassandra/destination : is the volume used to get the compiled elements for Guice Cassandra packaging and Cassandra-LDAP packaging.
- --volume $PWD/dockerfiles/run/guice/cassandra/destination:/jpa/destination : is the volume used to get the compiled elements for Guice JPA packaging.

Some tests needs a DOCKER_HOST environment variable in order to be played, they will be ignored if you don't provide this variable.
If you wish to play them, you may use a command like the following (depending on your docker configuration):

Expand All @@ -142,7 +124,7 @@ This feature is available for three configurations :

* Java 8 + Guice + Cassandra + ElasticSearch
* Java 8 + Guice + JPA + Lucene
* Java 6 + Spring + JPA
* Java 8 + Spring + JPA


==== Run James with Java 8 + Guice + Cassandra + ElasticSearch
Expand Down Expand Up @@ -236,11 +218,18 @@ You can add an optional port binding to port 8000, to expose the webadmin server
To have log file accessible on a volume, add *-v $PWD/logs:/logs* option to the above command line, where *$PWD/logs* is your local directory to put files in.


==== Run James with Java 6 + Spring + JPA
==== Run James with Java 8 + Spring + JPA

===== Requirements

Built artifacts should be in ./dockerfiles/run/spring/destination folder.
Built artifacts should be in ./dockerfiles/run/spring/destination folder for Spring.
If you haven't already:

$ docker build -t james/project dockerfiles/compilation/java-8
$ docker run -v $HOME/.m2:/root/.m2 -v $PWD:/origin \
-v $PWD/dockerfiles/run/spring/destination:/spring/destination \
-t james/project -s HEAD


===== Howto ?

Expand Down
277 changes: 62 additions & 215 deletions backends-common/cassandra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,220 +30,67 @@
<artifactId>apache-james-backends-cassandra</artifactId>
<name>Apache James Cassandra backend</name>

<profiles>
<profile>
<id>disable-build-for-older-jdk</id>
<activation>
<jdk>(,1.8)</jdk>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
<execution>
<id>jar</id>
<phase>none</phase>
</execution>
<execution>
<id>test-jar</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<phase>none</phase>
</execution>
<execution>
<id>default-testCompile</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>default-test</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>default-install</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>default-resources</id>
<phase>none</phase>
</execution>
<execution>
<id>default-testResources</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<executions>
<execution>
<id>attach-descriptor</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>build-for-jdk-8</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<dependencies>
<dependency>
<groupId>org.apache.james</groupId>
<artifactId>james-server-util-java8</artifactId>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>3.2.0</version>
<classifier>shaded</classifier>
<!-- Because the shaded JAR uses the original POM, you still need to
exclude this dependency explicitly: -->
<exclusions>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>net.javacrumbs.future-converter</groupId>
<artifactId>future-converter-java8-guava</artifactId>
<version>0.3.0</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-3.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.cassandraunit</groupId>
<artifactId>cassandra-unit</artifactId>
<version>2.1.9.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<version>1.7.6</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>fully.qualified.MainClass</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>animal-sniffer-java-8</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java18</artifactId>
<version>1.0</version>
</signature>
</configuration>
<executions>
<execution>
<id>check_java_8</id>
<phase>test</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>


<dependencies>
<dependency>
<groupId>org.apache.james</groupId>
<artifactId>james-server-util-java8</artifactId>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>3.2.0</version>
<classifier>shaded</classifier>
<!-- Because the shaded JAR uses the original POM, you still need to
exclude this dependency explicitly: -->
<exclusions>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>net.javacrumbs.future-converter</groupId>
<artifactId>future-converter-java8-guava</artifactId>
<version>0.3.0</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.cassandraunit</groupId>
<artifactId>cassandra-unit</artifactId>
<version>2.1.9.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<version>1.7.6</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Loading