我在Windows上使用命令行中的Maven,但我不需要专门从命令行更改端口。
运行命令
mvn -Djetty.http.port=8000 exec:java
产生以下输出:
[INFO] Scanning for projects...
[WARNING] The project com.google.apis-samples:oauth2-cmdline-sample:jar:1
uses prerequisites which is only intended for maven-plugin projects but not
for non maven-plugin projects. For such purposes you should use the maven-
enforcer-plugin. See https://maven.apache.org/enforcer/enforcer-
rules/requireMavenVersion.html
[INFO]
[INFO] ---------------------------------------------------------------------
---
[INFO] Building Example for the OAuth2 API using JSON and OAuth 2.0 1
[INFO] --------------------------------------------------------------------
----
[INFO]
[INFO] >>> exec-maven-plugin:1.1:java (default-cli) > validate @ oauth2-
cmdline-sample >>>
[INFO]
[INFO] <<< exec-maven-plugin:1.1:java (default-cli) < validate @ oauth2-
cmdline-sample <<<
[INFO]
[INFO]
[INFO] --- exec-maven-plugin:1.1:java (default-cli) @ oauth2-cmdline-sample
---
Jun 19, 2017 5:09:53 PM
com.google.api.client.util.store.FileDataStoreFactory
setPermissionsToOwnerOnly
WARNING: unable to change permissions for everybody:
C:\Users\roxlala\.store\oauth2_sample
Jun 19, 2017 5:09:53 PM
com.google.api.client.util.store.FileDataStoreFactory
setPermissionsToOwnerOnly
WARNING: unable to change permissions for owner:
C:\Users\roxlala\.store\oauth2_sample
2017-06-19 17:09:53.229:INFO::Logging to STDERR via
org.mortbay.log.StdErrLog
2017-06-19 17:09:53.229:INFO::jetty-6.1.26
2017-06-19 17:09:53.259:INFO::Started SocketConnector@localhost:1871
Please open the following address in your browser:
https://accounts.google.com/o/oauth2/auth?client_id=<my-id>.
googleusercontent.com&redirect_uri=http:
//localhost:1871/Callback&response_type=code&scope=https://www.googleapis.
com/auth
/userinfo.profile%20https://www.googleapis.com/auth/userinfo.email
Attempting to open that address in the default browser now...