Skip to content

Commit d18e13f

Browse files
authored
Maven GAE plugin config updates (#2442)
* Maven config updates * lint * lint * lint
1 parent c4c2add commit d18e13f

File tree

19 files changed

+133
-144
lines changed

19 files changed

+133
-144
lines changed

cloud-sql/mysql/servlet/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ environment variables into the runtime.
6262

6363
Next, the following command will deploy the application to your Google Cloud project:
6464
```bash
65-
mvn appengine:deploy
65+
mvn clean package appengine:deploy
6666
```
6767

6868
### Deploy to Cloud Run

cloud-sql/mysql/servlet/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<parent>
2828
<groupId>com.google.cloud.samples</groupId>
2929
<artifactId>shared-configuration</artifactId>
30-
<version>1.0.11</version>
30+
<version>1.0.12</version>
3131
</parent>
3232

3333
<properties>

cloud-sql/postgres/servlet/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ environment variables into the runtime.
6262

6363
Next, the following command will deploy the application to your Google Cloud project:
6464
```bash
65-
mvn appengine:deploy
65+
mvn clean package appengine:deploy
6666
```

cloud-sql/postgres/servlet/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<parent>
2828
<groupId>com.google.cloud.samples</groupId>
2929
<artifactId>shared-configuration</artifactId>
30-
<version>1.0.11</version>
30+
<version>1.0.12</version>
3131
</parent>
3232

3333
<properties>

memorystore/redis/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<parent>
2828
<groupId>com.google.cloud.samples</groupId>
2929
<artifactId>shared-configuration</artifactId>
30-
<version>1.0.11</version>
30+
<version>1.0.12</version>
3131
</parent>
3232

3333
<properties>

storage/cloud-client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<parent>
2727
<groupId>com.google.cloud.samples</groupId>
2828
<artifactId>shared-configuration</artifactId>
29-
<version>1.0.11</version>
29+
<version>1.0.12</version>
3030
</parent>
3131

3232
<properties>

storage/json-api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<parent>
2727
<groupId>com.google.cloud.samples</groupId>
2828
<artifactId>shared-configuration</artifactId>
29-
<version>1.0.11</version>
29+
<version>1.0.12</version>
3030
</parent>
3131

3232
<properties>

storage/s3-sdk/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<parent>
2727
<groupId>com.google.cloud.samples</groupId>
2828
<artifactId>shared-configuration</artifactId>
29-
<version>1.0.11</version>
29+
<version>1.0.12</version>
3030
</parent>
3131

3232
<properties>

storage/s3-sdk/src/main/java/ListGcsBuckets.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,23 @@
2121
import com.amazonaws.services.s3.AmazonS3;
2222
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
2323
import com.amazonaws.services.s3.model.Bucket;
24-
2524
import java.util.List;
2625

2726
public class ListGcsBuckets {
28-
public static void listGcsBuckets(String googleAccessKeyId,
29-
String googleAccessKeySecret) {
27+
public static void listGcsBuckets(String googleAccessKeyId, String googleAccessKeySecret) {
3028

3129
// String googleAccessKeyId = "your-google-access-key-id";
3230
// String googleAccessKeySecret = "your-google-access-key-secret";
3331

3432
// Create a BasicAWSCredentials using Cloud Storage HMAC credentials.
35-
BasicAWSCredentials googleCreds = new BasicAWSCredentials(googleAccessKeyId,
36-
googleAccessKeySecret);
33+
BasicAWSCredentials googleCreds =
34+
new BasicAWSCredentials(googleAccessKeyId, googleAccessKeySecret);
3735

3836
// Create a new client and do the following:
3937
// 1. Change the endpoint URL to use the Google Cloud Storage XML API endpoint.
4038
// 2. Use Cloud Storage HMAC Credentials.
41-
AmazonS3 interopClient = AmazonS3ClientBuilder.standard()
39+
AmazonS3 interopClient =
40+
AmazonS3ClientBuilder.standard()
4241
.withEndpointConfiguration(
4342
new AwsClientBuilder.EndpointConfiguration(
4443
"https://storage.googleapis.com", "auto"))
@@ -59,4 +58,3 @@ public static void listGcsBuckets(String googleAccessKeyId,
5958
}
6059
// [END storage_s3_sdk_list_buckets]
6160
}
62-

storage/s3-sdk/src/main/java/ListGcsObjects.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,32 @@
1414
* limitations under the License.
1515
*/
1616

17-
1817
// [START storage_s3_sdk_list_objects]
1918
import com.amazonaws.auth.AWSStaticCredentialsProvider;
2019
import com.amazonaws.auth.BasicAWSCredentials;
2120
import com.amazonaws.client.builder.AwsClientBuilder;
22-
2321
import com.amazonaws.services.s3.AmazonS3;
2422
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
2523
import com.amazonaws.services.s3.model.ObjectListing;
2624
import com.amazonaws.services.s3.model.S3ObjectSummary;
2725

28-
import java.util.List;
29-
3026
public class ListGcsObjects {
31-
public static void listGcsObjects(String googleAccessKeyId,
32-
String googleAccessKeySecret, String bucketName) {
27+
public static void listGcsObjects(
28+
String googleAccessKeyId, String googleAccessKeySecret, String bucketName) {
3329

3430
// String googleAccessKeyId = "your-google-access-key-id";
3531
// String googleAccessKeySecret = "your-google-access-key-secret";
3632
// String bucketName = "bucket-name";
3733

3834
// Create a BasicAWSCredentials using Cloud Storage HMAC credentials.
39-
BasicAWSCredentials googleCreds = new BasicAWSCredentials(googleAccessKeyId,
40-
googleAccessKeySecret);
35+
BasicAWSCredentials googleCreds =
36+
new BasicAWSCredentials(googleAccessKeyId, googleAccessKeySecret);
4137

4238
// Create a new client and do the following:
4339
// 1. Change the endpoint URL to use the Google Cloud Storage XML API endpoint.
4440
// 2. Use Cloud Storage HMAC Credentials.
45-
AmazonS3 interopClient = AmazonS3ClientBuilder.standard()
41+
AmazonS3 interopClient =
42+
AmazonS3ClientBuilder.standard()
4643
.withEndpointConfiguration(
4744
new AwsClientBuilder.EndpointConfiguration(
4845
"https://storage.googleapis.com", "auto"))

storage/s3-sdk/src/test/java/ListGcsBucketsTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import static org.junit.Assert.assertThat;
1919

2020
import com.amazonaws.services.s3.model.Bucket;
21-
2221
import java.io.ByteArrayOutputStream;
2322
import java.io.PrintStream;
2423
import java.util.List;

storage/s3-sdk/src/test/java/ListGcsObjectsTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import com.amazonaws.services.s3.model.Bucket;
2121
import com.amazonaws.services.s3.model.ObjectListing;
22-
2322
import java.io.ByteArrayOutputStream;
2423
import java.io.PrintStream;
2524
import java.util.List;

storage/storage-transfer/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<parent>
3131
<groupId>com.google.cloud.samples</groupId>
3232
<artifactId>shared-configuration</artifactId>
33-
<version>1.0.11</version>
33+
<version>1.0.12</version>
3434
</parent>
3535

3636
<properties>

storage/xml-api/cmdline-sample/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<parent>
2727
<groupId>com.google.cloud.samples</groupId>
2828
<artifactId>shared-configuration</artifactId>
29-
<version>1.0.11</version>
29+
<version>1.0.12</version>
3030
</parent>
3131

3232
<properties>

storage/xml-api/cmdline-sample/src/main/java/StorageSample.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,12 @@
2222
import com.google.api.client.http.HttpResponse;
2323
import com.google.api.client.http.HttpTransport;
2424
import com.google.api.client.util.Preconditions;
25-
2625
import java.io.IOException;
2726
import java.io.StringReader;
2827
import java.io.StringWriter;
2928
import java.net.URLEncoder;
3029
import java.security.GeneralSecurityException;
3130
import java.util.Collections;
32-
3331
import javax.xml.transform.OutputKeys;
3432
import javax.xml.transform.Source;
3533
import javax.xml.transform.Transformer;

storage/xml-api/serviceaccount-appengine-sample/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Running and Deploying Your Application from the Command Line
3333

3434
To run your application locally on a development server:
3535

36-
mvn appengine:devserver
36+
mvn appengine:run
3737

3838
To deploy your application to appspot.com:
3939

storage/xml-api/serviceaccount-appengine-sample/pom.xml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<parent>
2424
<groupId>com.google.cloud.samples</groupId>
2525
<artifactId>shared-configuration</artifactId>
26-
<version>1.0.11</version>
26+
<version>1.0.12</version>
2727
</parent>
2828

2929
<groupId>com.google.apis-samples</groupId>
@@ -82,14 +82,16 @@
8282
</plugin>
8383

8484
<!--
85-
The actual appengine-maven-plugin. Type "mvn appengine:devserver" to run project,
85+
The actual appengine-maven-plugin. Type "mvn appengine:run" to run project,
8686
"mvn appengine:update" to upload to GAE.
8787
-->
8888
<plugin>
89-
<groupId>com.google.appengine</groupId>
89+
<groupId>com.google.cloud.tools</groupId>
9090
<artifactId>appengine-maven-plugin</artifactId>
91-
<version>1.9.77</version>
91+
<version>2.2.0</version>
9292
<configuration>
93+
<projectId>GCLOUD_CONFIG</projectId>
94+
<version>gaeinfo</version>
9395
<port>8888</port>
9496
</configuration>
9597
</plugin>

storage/xml-api/serviceaccount-appengine-sample/src/main/java/com/google/api/client/sample/storage/appengine/serviceaccount/StorageSample.java

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@
2323
import com.google.api.client.http.HttpResponse;
2424
import com.google.api.client.http.HttpTransport;
2525
import com.google.api.client.http.javanet.NetHttpTransport;
26-
2726
import java.io.BufferedWriter;
2827
import java.io.IOException;
2928
import java.io.OutputStreamWriter;
3029
import java.util.Arrays;
31-
3230
import javax.servlet.http.HttpServlet;
3331
import javax.servlet.http.HttpServletRequest;
3432
import javax.servlet.http.HttpServletResponse;
@@ -46,8 +44,7 @@ public class StorageSample extends HttpServlet {
4644
private static final int HTTP_OK = 200;
4745

4846
/** The base endpoint for Google Cloud Storage api calls. */
49-
private static final String GCS_URI =
50-
"http://commondatastorage.googleapis.com";
47+
private static final String GCS_URI = "http://commondatastorage.googleapis.com";
5148

5249
/** Global configuration of Google Cloud Storage OAuth 2.0 scope. */
5350
private static final String STORAGE_SCOPE =
@@ -65,35 +62,30 @@ protected void doGet(final HttpServletRequest req, final HttpServletResponse res
6562
throws IOException {
6663

6764
try {
68-
AppIdentityCredential credential = new AppIdentityCredential(
69-
Arrays.asList(STORAGE_SCOPE));
65+
AppIdentityCredential credential = new AppIdentityCredential(Arrays.asList(STORAGE_SCOPE));
7066

7167
// Set up and execute Google Cloud Storage request.
7268
String bucketName = req.getRequestURI();
7369
if (bucketName.equals("/")) {
7470
resp.sendError(
75-
HTTP_NOT_FOUND,
76-
"No bucket specified - append /bucket-name to the URL and retry.");
71+
HTTP_NOT_FOUND, "No bucket specified - append /bucket-name to the URL and retry.");
7772
return;
7873
}
7974
// Remove any trailing slashes, if found.
80-
//[START snippet]
75+
// [START snippet]
8176
String cleanBucketName = bucketName.replaceAll("/$", "");
8277
String uri = GCS_URI + cleanBucketName;
83-
HttpRequestFactory requestFactory =
84-
HTTP_TRANSPORT.createRequestFactory(credential);
78+
HttpRequestFactory requestFactory = HTTP_TRANSPORT.createRequestFactory(credential);
8579
GenericUrl url = new GenericUrl(uri);
8680
HttpRequest request = requestFactory.buildGetRequest(url);
8781
HttpResponse response = request.execute();
8882
String content = response.parseAsString();
89-
//[END snippet]
83+
// [END snippet]
9084

9185
// Display the output XML.
9286
resp.setContentType("text/xml");
93-
BufferedWriter writer = new BufferedWriter(
94-
new OutputStreamWriter(resp.getOutputStream()));
95-
String formattedContent = content.replaceAll(
96-
"(<ListBucketResult)", XSL + "$1");
87+
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(resp.getOutputStream()));
88+
String formattedContent = content.replaceAll("(<ListBucketResult)", XSL + "$1");
9789
writer.append(formattedContent);
9890
writer.flush();
9991
resp.setStatus(HTTP_OK);

0 commit comments

Comments
 (0)