private static File detectHomeDir() { | private static File detectHomeDir() { | ||||
try { | 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(); | return appJar.getParentFile().getParentFile(); | ||||
} catch (URISyntaxException e) { | |||||
} catch (URISyntaxException | ClassNotFoundException e) { | |||||
throw new IllegalStateException("Cannot detect path of main jar file", e); | throw new IllegalStateException("Cannot detect path of main jar file", e); | ||||
} | } | ||||
} | } |
/* | |||||
* 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 { | |||||
} |
<?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> |
<scope>provided</scope> | <scope>provided</scope> | ||||
</dependencySet> | </dependencySet> | ||||
<dependencySet> | |||||
<outputDirectory>lib/common</outputDirectory> | |||||
<useTransitiveFiltering>true</useTransitiveFiltering> | |||||
<useProjectArtifact>false</useProjectArtifact> | |||||
<scope>runtime</scope> | |||||
</dependencySet> | |||||
<dependencySet> | <dependencySet> | ||||
<outputDirectory>lib/server</outputDirectory> | <outputDirectory>lib/server</outputDirectory> | ||||
<useProjectArtifact>false</useProjectArtifact> | <useProjectArtifact>false</useProjectArtifact> | ||||
</dependencySets> | </dependencySets> | ||||
<fileSets> | <fileSets> | ||||
<!-- common directory --> | |||||
<fileSet> | |||||
<directory>target/common</directory> | |||||
<outputDirectory>lib/common</outputDirectory> | |||||
</fileSet> | |||||
<!-- wrapper binaries --> | <!-- wrapper binaries --> | ||||
<fileSet> | <fileSet> | ||||
<directory>src/main/assembly</directory> | <directory>src/main/assembly</directory> |
<?xml version="1.0" encoding="UTF-8"?> | <?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> | <modelVersion>4.0.0</modelVersion> | ||||
<parent> | <parent> | ||||
<archive> | <archive> | ||||
<index>true</index> | <index>true</index> | ||||
<manifest> | <manifest> | ||||
<addClasspath>false</addClasspath> | |||||
<addClasspath>true</addClasspath> | |||||
<classpathPrefix>common</classpathPrefix> | |||||
<mainClass>org.sonar.application.App</mainClass> | <mainClass>org.sonar.application.App</mainClass> | ||||
</manifest> | </manifest> | ||||
<manifestEntries> | <manifestEntries> | ||||
</configuration> | </configuration> | ||||
</plugin> | </plugin> | ||||
<plugin> | <plugin> | ||||
<groupId>org.apache.maven.plugins</groupId> | |||||
<artifactId>maven-shade-plugin</artifactId> | |||||
<artifactId>maven-assembly-plugin</artifactId> | |||||
<executions> | <executions> | ||||
<execution> | <execution> | ||||
<phase>package</phase> | |||||
<id>assemble-common-lib-dir</id> | |||||
<phase>prepare-package</phase> | |||||
<goals> | <goals> | ||||
<goal>shade</goal> | |||||
<goal>single</goal> | |||||
</goals> | </goals> | ||||
<configuration> | <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> | </configuration> | ||||
</execution> | </execution> | ||||
</executions> | |||||
</plugin> | |||||
<plugin> | |||||
<artifactId>maven-assembly-plugin</artifactId> | |||||
<executions> | |||||
<execution> | <execution> | ||||
<id>assemble-distribution-zip</id> | |||||
<phase>package</phase> | <phase>package</phase> | ||||
<goals> | <goals> | ||||
<goal>single</goal> | <goal>single</goal> | ||||
<configuration> | <configuration> | ||||
<rules> | <rules> | ||||
<requireFilesSize> | <requireFilesSize> | ||||
<minsize>200000000</minsize> | |||||
<maxsize>215000000</maxsize> | |||||
<minsize>165000000</minsize> | |||||
<maxsize>180000000</maxsize> | |||||
<files> | <files> | ||||
<file>${project.build.directory}/sonarqube-${project.version}.zip</file> | <file>${project.build.directory}/sonarqube-${project.version}.zip</file> | ||||
</files> | </files> |
wrapper.java.additional.2=-Djava.awt.headless=true | wrapper.java.additional.2=-Djava.awt.headless=true | ||||
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp | wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp | ||||
wrapper.java.classpath.1=../../lib/jsw/*.jar | 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.java.library.path.1=./lib | ||||
wrapper.app.parameter.1=org.sonar.application.App | wrapper.app.parameter.1=org.sonar.application.App | ||||
wrapper.java.initmemory=8 | wrapper.java.initmemory=8 |