Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Commit 313e4c1

Browse files
author
Christopher Legan
committed
clean up project and subproject structure for the java-grails2 sample using the latest v2 swagger dependencies, also making it a jersey2 based sample.
1 parent f819604 commit 313e4c1

File tree

13 files changed

+29461
-3028
lines changed

13 files changed

+29461
-3028
lines changed

java/java-grails2/grails-app/conf/BuildConfig.groovy

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,34 @@ grails.project.dependency.resolution = {
1515
// excludes 'ehcache'
1616
excludes 'grails-plugin-log4j'
1717
}
18-
log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
18+
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
1919
checksums true // Whether to verify checksums on resolve
2020

2121
repositories {
2222
inherits true // Whether to inherit repository definitions from plugins
23+
mavenRepo "https://repo.grails.org/grails/plugins"
24+
mavenRepo "http://repo.grails.org/grails/repo"
2325

24-
grailsPlugins()
25-
grailsHome()
26-
grailsCentral()
27-
28-
mavenLocal()
29-
mavenCentral()
30-
31-
// uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
32-
mavenRepo "http://snapshots.repository.codehaus.org"
33-
mavenRepo "https://oss.sonatype.org/content/repositories/snapshots"
34-
mavenRepo "http://repository.codehaus.org"
26+
mavenRepo "http://repo1.maven.org/maven2/"
27+
mavenRepo "http://repository.ow2.org/nexus/content/repositories/public"
28+
mavenRepo "http://repo.grails.org/grails/core"
29+
mavenRepo "https://oss.sonatype.org/content/groups/public/"
3530
mavenRepo "http://download.java.net/maven/2/"
3631
mavenRepo "http://repository.jboss.com/maven2/"
3732
mavenRepo "http://maven.restlet.org"
3833
}
3934
dependencies {
4035
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
41-
compile 'io.swagger:swagger-jaxrs:1.5.0-SNAPSHOT'
42-
compile 'ch.qos.logback:logback-classic:1.0.6'
36+
compile 'io.swagger:swagger-core:1.5.0'
37+
// TODO wonder if we can pull in swagger-ui resources like this
38+
// compile 'org.webjars:swagger-ui:2.1.0'
39+
compile 'io.swagger:swagger-jersey2-jaxrs:1.5.0'
4340
runtime 'ch.qos.logback:logback-classic:1.0.6'
4441
}
4542

4643
plugins {
47-
runtime ":hibernate:$grailsVersion"
44+
45+
runtime ":hibernate:$grailsVersion"
4846
runtime ":jquery:1.8.0"
4947
runtime ":resources:1.1.6"
5048
compile ':jaxrs:0.8'

java/java-grails2/grails-app/conf/Config.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
org.grails.jaxrs.url.mappings = ['/api','/swagger.*']
22
org.grails.jaxrs.provider.init.parameters = [
33
'com.sun.jersey.config.property.packages':
4-
'io.swagger.swagger.sample.resource;io.swagger.swagger.jaxrs.listing;io.swagger.swagger.jaxrs.json']
4+
'io.swagger.sample.resource;io.swagger.sample.model;io.swagger.jaxrs.listing;io.swagger.jaxrs.json']
55

66
grails.project.groupId = appName // change this to alter the default package name and Maven publishing destination
77
grails.mime.file.extensions = true // enables the parsing of file extensions from URLs into the request format

java/java-grails2/pom.xml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
<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/maven-v4_0_0.xsd">
2+
<parent>
3+
<groupId>io.swagger</groupId>
4+
<artifactId>swagger-samples-project</artifactId>
5+
<version>1.0.0</version>
6+
<relativePath>../..</relativePath>
7+
</parent>
8+
<modelVersion>4.0.0</modelVersion>
9+
<groupId>io.swagger</groupId>
10+
<artifactId>swagger-java-grails2-jersey2-sample-app</artifactId>
11+
<packaging>war</packaging>
12+
<name>swagger-java-grails2-jersey2-app</name>
13+
<version>1.0.0</version>
14+
<build>
15+
<sourceDirectory>src/java</sourceDirectory>
16+
<plugins>
17+
<plugin>
18+
<groupId>org.apache.maven.plugins</groupId>
19+
<artifactId>maven-war-plugin</artifactId>
20+
<version>2.1.1</version>
21+
</plugin>
22+
<plugin>
23+
<artifactId>maven-failsafe-plugin</artifactId>
24+
<version>2.6</version>
25+
<executions>
26+
<execution>
27+
<goals>
28+
<goal>integration-test</goal>
29+
<goal>verify</goal>
30+
</goals>
31+
</execution>
32+
</executions>
33+
</plugin>
34+
<plugin>
35+
<groupId>org.eclipse.jetty</groupId>
36+
<artifactId>jetty-maven-plugin</artifactId>
37+
<version>${jetty-version}</version>
38+
<configuration>
39+
<webApp>
40+
<contextPath>/</contextPath>
41+
</webApp>
42+
<webAppSourceDirectory>target/${project.artifactId}-${project.version}</webAppSourceDirectory>
43+
<stopPort>8079</stopPort>
44+
<stopKey>stopit</stopKey>
45+
<httpConnector>
46+
<port>8002</port>
47+
<idleTimeout>60000</idleTimeout>
48+
</httpConnector>
49+
</configuration>
50+
<executions>
51+
<execution>
52+
<id>start-jetty</id>
53+
<phase>pre-integration-test</phase>
54+
<goals>
55+
<goal>run</goal>
56+
</goals>
57+
<configuration>
58+
<scanIntervalSeconds>0</scanIntervalSeconds>
59+
<daemon>true</daemon>
60+
</configuration>
61+
</execution>
62+
<execution>
63+
<id>stop-jetty</id>
64+
<phase>post-integration-test</phase>
65+
<goals>
66+
<goal>stop</goal>
67+
</goals>
68+
</execution>
69+
</executions>
70+
</plugin>
71+
<plugin>
72+
<groupId>com.googlecode.maven-download-plugin</groupId>
73+
<artifactId>download-maven-plugin</artifactId>
74+
<version>1.2.1</version>
75+
<executions>
76+
<execution>
77+
<id>swagger-ui</id>
78+
<goals>
79+
<goal>wget</goal>
80+
</goals>
81+
<configuration>
82+
<url>https://github.com/swagger-api/swagger-ui/archive/master.tar.gz</url>
83+
<unpack>true</unpack>
84+
<outputDirectory>${project.build.directory}</outputDirectory>
85+
</configuration>
86+
</execution>
87+
</executions>
88+
</plugin>
89+
<plugin>
90+
<artifactId>maven-resources-plugin</artifactId>
91+
<version>2.6</version>
92+
<executions>
93+
<execution>
94+
<id>copy-resources</id>
95+
<phase>validate</phase>
96+
<goals>
97+
<goal>copy-resources</goal>
98+
</goals>
99+
<configuration>
100+
<outputDirectory>target/${project.artifactId}-${project.version}</outputDirectory>
101+
<resources>
102+
<resource>
103+
<directory>${project.build.directory}/swagger-ui-master/dist</directory>
104+
<filtering>true</filtering>
105+
<excludes>
106+
<exclude>index.html</exclude>
107+
</excludes>
108+
</resource>
109+
</resources>
110+
</configuration>
111+
</execution>
112+
</executions>
113+
</plugin>
114+
</plugins>
115+
</build>
116+
<dependencies>
117+
<dependency>
118+
<groupId>io.swagger</groupId>
119+
<artifactId>swagger-jersey2-jaxrs</artifactId>
120+
<scope>compile</scope>
121+
<version>${swagger-version}</version>
122+
</dependency>
123+
<dependency>
124+
<groupId>ch.qos.logback</groupId>
125+
<artifactId>logback-classic</artifactId>
126+
<version>${logback-version}</version>
127+
<scope>compile</scope>
128+
</dependency>
129+
<dependency>
130+
<groupId>ch.qos.logback</groupId>
131+
<artifactId>logback-core</artifactId>
132+
<version>${logback-version}</version>
133+
<scope>compile</scope>
134+
</dependency>
135+
<dependency>
136+
<groupId>org.scalatest</groupId>
137+
<artifactId>scalatest_2.10</artifactId>
138+
<scope>test</scope>
139+
</dependency>
140+
<dependency>
141+
<groupId>junit</groupId>
142+
<artifactId>junit</artifactId>
143+
<scope>test</scope>
144+
</dependency>
145+
<dependency>
146+
<groupId>javax.servlet</groupId>
147+
<artifactId>servlet-api</artifactId>
148+
</dependency>
149+
<dependency>
150+
<groupId>org.glassfish.jersey.containers</groupId>
151+
<artifactId>jersey-container-servlet-core</artifactId>
152+
<version>${jersey2-version}</version>
153+
</dependency>
154+
<dependency>
155+
<groupId>org.glassfish.jersey.media</groupId>
156+
<artifactId>jersey-media-multipart</artifactId>
157+
<version>${jersey2-version}</version>
158+
</dependency>
159+
</dependencies>
160+
<properties>
161+
<jetty-version>9.0.7.v20131107</jetty-version>
162+
<jersey2-version>2.6</jersey2-version>
163+
</properties>
164+
</project>

java/java-grails2/src/java/io/swagger/sample/data/PetData.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
package io.swagger.sample.data;
1818

19+
import io.swagger.sample.model.Category;
20+
import io.swagger.sample.model.Pet;
21+
import io.swagger.sample.model.Tag;
22+
1923
import java.util.*;
2024

2125
public class PetData {

java/java-grails2/src/java/io/swagger/sample/data/StoreData.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package io.swagger.sample.data;
1818

19+
import io.swagger.sample.model.Order;
20+
1921
import java.util.Date;
2022
import java.util.List;
2123
import java.util.ArrayList;

java/java-grails2/src/java/io/swagger/sample/data/UserData.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package io.swagger.sample.data;
1818

19+
import io.swagger.sample.model.User;
20+
1921
import java.util.List;
2022
import java.util.ArrayList;
2123

java/java-grails2/src/java/io/swagger/sample/util/ApiAuthorizationFilterImpl.java_

Lines changed: 0 additions & 81 deletions
This file was deleted.

java/java-grails2/src/java/io/swagger/sample/util/ApiOriginFilter.java

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)