aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-main/src/main/java/org/sonar/application/config/AppSettingsLoaderImpl.java4
-rw-r--r--server/sonar-main/src/test/java/org/sonar/application/App.java29
-rw-r--r--sonar-application/assembly-common.xml19
-rw-r--r--sonar-application/assembly.xml13
-rw-r--r--sonar-application/pom.xml48
-rw-r--r--sonar-application/src/main/assembly/conf/wrapper.conf3
6 files changed, 74 insertions, 42 deletions
diff --git a/server/sonar-main/src/main/java/org/sonar/application/config/AppSettingsLoaderImpl.java b/server/sonar-main/src/main/java/org/sonar/application/config/AppSettingsLoaderImpl.java
index 50436b6468c..e9c5ebc89ec 100644
--- a/server/sonar-main/src/main/java/org/sonar/application/config/AppSettingsLoaderImpl.java
+++ b/server/sonar-main/src/main/java/org/sonar/application/config/AppSettingsLoaderImpl.java
@@ -74,9 +74,9 @@ public class AppSettingsLoaderImpl implements AppSettingsLoader {
private static File detectHomeDir() {
try {
- File appJar = new File(AppSettingsLoaderImpl.class.getProtectionDomain().getCodeSource().getLocation().toURI());
+ File appJar = new File(Class.forName("org.sonar.application.App").getProtectionDomain().getCodeSource().getLocation().toURI());
return appJar.getParentFile().getParentFile();
- } catch (URISyntaxException e) {
+ } catch (URISyntaxException | ClassNotFoundException e) {
throw new IllegalStateException("Cannot detect path of main jar file", e);
}
}
diff --git a/server/sonar-main/src/test/java/org/sonar/application/App.java b/server/sonar-main/src/test/java/org/sonar/application/App.java
new file mode 100644
index 00000000000..d084227359e
--- /dev/null
+++ b/server/sonar-main/src/test/java/org/sonar/application/App.java
@@ -0,0 +1,29 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.application;
+
+/**
+ * This class is looked for by {@link org.sonar.application.config.AppSettingsLoaderImpl} to locate the location
+ * of SQ's sonar-application jar file.
+ *
+ * Adding a fake one here to be able to test the feature in {@link org.sonar.application.config.AppSettingsLoaderImplTest}.
+ */
+public class App {
+}
diff --git a/sonar-application/assembly-common.xml b/sonar-application/assembly-common.xml
new file mode 100644
index 00000000000..8d85b77149b
--- /dev/null
+++ b/sonar-application/assembly-common.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<assembly>
+ <id>common-lib-dir</id>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <baseDirectory>/</baseDirectory>
+ <dependencySets>
+
+ <dependencySet>
+ <outputDirectory>/</outputDirectory>
+ <useTransitiveFiltering>true</useTransitiveFiltering>
+ <useProjectArtifact>false</useProjectArtifact>
+ <scope>runtime</scope>
+ </dependencySet>
+
+ </dependencySets>
+
+</assembly>
diff --git a/sonar-application/assembly.xml b/sonar-application/assembly.xml
index 5d5e0b47947..16e91b4d690 100644
--- a/sonar-application/assembly.xml
+++ b/sonar-application/assembly.xml
@@ -28,14 +28,6 @@
<scope>provided</scope>
</dependencySet>
-
- <dependencySet>
- <outputDirectory>lib/common</outputDirectory>
- <useTransitiveFiltering>true</useTransitiveFiltering>
- <useProjectArtifact>false</useProjectArtifact>
- <scope>runtime</scope>
- </dependencySet>
-
<dependencySet>
<outputDirectory>lib/server</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
@@ -122,6 +114,11 @@
</dependencySets>
<fileSets>
+ <!-- common directory -->
+ <fileSet>
+ <directory>target/common</directory>
+ <outputDirectory>lib/common</outputDirectory>
+ </fileSet>
<!-- wrapper binaries -->
<fileSet>
<directory>src/main/assembly</directory>
diff --git a/sonar-application/pom.xml b/sonar-application/pom.xml
index c50e6d785d1..709e73367ad 100644
--- a/sonar-application/pom.xml
+++ b/sonar-application/pom.xml
@@ -1,5 +1,7 @@
<?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/xsd/maven-4.0.0.xsd">
+<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -180,7 +182,8 @@
<archive>
<index>true</index>
<manifest>
- <addClasspath>false</addClasspath>
+ <addClasspath>true</addClasspath>
+ <classpathPrefix>common</classpathPrefix>
<mainClass>org.sonar.application.App</mainClass>
</manifest>
<manifestEntries>
@@ -191,41 +194,24 @@
</configuration>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
+ <artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
- <phase>package</phase>
+ <id>assemble-common-lib-dir</id>
+ <phase>prepare-package</phase>
<goals>
- <goal>shade</goal>
+ <goal>single</goal>
</goals>
<configuration>
- <keepDependenciesWithProvidedScope>false</keepDependenciesWithProvidedScope>
- <artifactSet>
- <!--excluding some transitive dependencies which are not necessary to the main process to create-->
- <!--a smaller jar and use less memory-->
- <excludes>
- <exclude>org.apache.lucene:lucene-analyzers-common</exclude>
- <exclude>org.apache.lucene:lucene-backward-codecs</exclude>
- <exclude>org.apache.lucene:lucene-grouping</exclude>
- <exclude>org.apache.lucene:lucene-memory</exclude>
- <exclude>org.apache.lucene:lucene-misc</exclude>
- <exclude>org.apache.lucene:lucene-spatial-extras</exclude>
- <exclude>org.apache.lucene:lucene-spatial3d</exclude>
- <exclude>org.elasticsearch.plugin:reindex-client</exclude>
- <exclude>org.elasticsearch.plugin:lang-mustache-client</exclude>
- <exclude>org.elasticsearch.plugin:percolator-client</exclude>
- <exclude>org.elasticsearch.plugin:transport-netty3-client</exclude>
- </excludes>
- </artifactSet>
+ <appendAssemblyId>false</appendAssemblyId>
+ <finalName>common</finalName>
+ <descriptors>
+ <descriptor>assembly-common.xml</descriptor>
+ </descriptors>
</configuration>
</execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
<execution>
+ <id>assemble-distribution-zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
@@ -254,8 +240,8 @@
<configuration>
<rules>
<requireFilesSize>
- <minsize>200000000</minsize>
- <maxsize>215000000</maxsize>
+ <minsize>165000000</minsize>
+ <maxsize>180000000</maxsize>
<files>
<file>${project.build.directory}/sonarqube-${project.version}.zip</file>
</files>
diff --git a/sonar-application/src/main/assembly/conf/wrapper.conf b/sonar-application/src/main/assembly/conf/wrapper.conf
index 8fb972ab0b1..6b7e2eff1c7 100644
--- a/sonar-application/src/main/assembly/conf/wrapper.conf
+++ b/sonar-application/src/main/assembly/conf/wrapper.conf
@@ -16,7 +16,8 @@ wrapper.java.additional.1=-Dsonar.wrapped=true
wrapper.java.additional.2=-Djava.awt.headless=true
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
wrapper.java.classpath.1=../../lib/jsw/*.jar
-wrapper.java.classpath.2=../../lib/*.jar
+wrapper.java.classpath.2=../../lib/common/*.jar
+wrapper.java.classpath.3=../../lib/*.jar
wrapper.java.library.path.1=./lib
wrapper.app.parameter.1=org.sonar.application.App
wrapper.java.initmemory=8