Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

Commit

Permalink
update example to build runnable jar
Browse files Browse the repository at this point in the history
  • Loading branch information
rouzwawi committed Nov 17, 2015
1 parent a749b6e commit 7d63ecc
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 83 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
* -\-\-
* Spotify Apollo API Implementations
* --
* Copyright (C) 2013 - 2015 Spotify AB
* --
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* -/-/-
*/
package com.spotify.apollo.meta;

import org.junit.Test;
Expand Down
12 changes: 11 additions & 1 deletion examples/calculator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,15 @@
`mvn package`

### Run
`java -jar target/calculator.jar`
`java -jar target/calculator-service.jar`

### Call
```
$ http :8080/add t1==28 t2==14
HTTP/1.1 200 OK
Content-Length: 2
Date: Tue, 17 Nov 2015 18:01:32 GMT
Server: Jetty(9.3.4.v20151007)
42
```
119 changes: 41 additions & 78 deletions examples/calculator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
<modelVersion>4.0.0</modelVersion>

<name>Spotify Apollo Example Calculator App</name>
<description>
Used both as examples of how a minimal apollo-core and an apollo-http-service would
look, but also used to verify that the enforcer plugin is happy with the versions that
those dependencies transitively bring in.
</description>
<description>A simple calculator application</description>
<groupId>com.spotify</groupId>
<artifactId>apollo-example</artifactId>
<version>1.0.0-rc3-foss-SNAPSHOT</version>
<artifactId>calculator-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<dependencyManagement>
Expand All @@ -31,23 +27,6 @@
<artifactId>apollo-http-service</artifactId>
</dependency>

<dependency>
<groupId>com.spotify</groupId>
<artifactId>apollo-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
Expand All @@ -56,6 +35,7 @@
</dependencies>

<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
Expand Down Expand Up @@ -86,60 +66,43 @@
</compilerArgs>
</configuration>
</plugin>

<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
<configuration>
<useBaseVersion>false</useBaseVersion>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<includeScope>runtime</includeScope>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</plugin>

<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<addMavenDescriptor>true</addMavenDescriptor>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.spotify.apollo.example.CalculatorApp</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>missinglink</id>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>missinglink-maven-plugin</artifactId>
<version>0.1.1</version>
<configuration>
<failOnConflicts>true</failOnConflicts>
<ignoreDestinationPackages>
<!-- not always present for all modules, will be present in final artifact -->
<ignoreDestinationPackage>
<package>org.slf4j.impl</package>
</ignoreDestinationPackage>
<!-- used by logback, optionally -->
<ignoreDestinationPackage>
<package>org.codehaus.groovy</package>
</ignoreDestinationPackage>
<!-- used by logback, optionally -->
<ignoreDestinationPackage>
<package>groovy</package>
</ignoreDestinationPackage>
<!-- may be used by logback, feature disabled if not present -->
<ignoreDestinationPackage>
<package>org.codehaus.janino</package>
</ignoreDestinationPackage>
<!-- netty references this for < Java 7 JDKs -->
<ignoreDestinationPackage>
<package>com.jcraft.jzlib</package>
</ignoreDestinationPackage>
</ignoreDestinationPackages>
<ignoreSourcePackages>
<ignoreSourcePackage>
<package>io.netty.util.internal</package>
</ignoreSourcePackage>
</ignoreSourcePackages>
</configuration>
<executions>
<execution>
<id>check</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Copyright (c) 2013-2015 Spotify AB
*/

package com.spotify.apollo.example;

import com.spotify.apollo.Environment;
Expand Down

0 comments on commit 7d63ecc

Please sign in to comment.