Plugin could not be resolved. Ensure the plugin's groupId, artifactId and version are present.
Additional information: Unable to resolve org.apache.maven.plugins:maven-javadoc-plugin
Plugin could not be resolved. Ensure the plugin's groupId, artifactId and version are present.
Additional information: Unable to resolve org.apache.maven.plugins:maven-project-info-reports-plugin
publicclassGmailOAuth{privatestaticfinalStringSCOPE="https://mail.google.com/";privatestaticfinalStringCLIENT_ID="CLIENT_ID";privatestaticfinalStringCLIENT_SECRET="CLIENT_SECRET";privatestaticfinalStringREDIRECT_URI="urn:ietf:wg:oauth:2.0:oob";privatestaticfinalStringMAIL_FROM="sender@foo.bar";privatestaticfinalStringMAIL_TO="receiver@foo.bar";publicstaticvoidmain(String[]args)throwsIOException,MessagingException{// 取得した認証コードを保存するフォルダを指定varfileDataStoreFactory=newFileDataStoreFactory(newFile(System.getProperty("java.io.tmpdir")));// OAuth 2.0 の認証フローを作成varflow=new GoogleAuthorizationCodeFlow.Builder(newNetHttpTransport(),GsonFactory.getDefaultInstance(), CLIENT_ID, CLIENT_SECRET,Set.of(SCOPE)).setCredentialDataStore(StoredCredential.getDefaultDataStore(fileDataStoreFactory)).build();// アクセス トークンを取得varcredential=flow.loadCredential("user");// 取得済みの認証情報があるか、またそれは有効か確認if(credential ==null||(credential.getExpiresInSeconds()<100&&!credential.refreshToken())){// 有効なコードがなかった場合、新たに認可コードを取得varurl=flow.newAuthorizationUrl().setRedirectUri(REDIRECT_URI).build();System.out.println("Please open the following URL in your browser then type the authorization code:");System.out.println(""+ url);System.out.println("Please enter your authentication code:");try(vars=newScanner(System.in)){varcode=s.nextLine();vartokenResponse=flow.newTokenRequest(code).setRedirectUri(REDIRECT_URI).execute(); credential =flow.createAndStoreCredential(tokenResponse,"user");}}// SMTP セッションを作成varprops=newProperties();props.put("mail.smtp.host","smtp.gmail.com");props.put("mail.smtp.port","587");props.put("mail.smtp.auth","true");props.put("mail.smtp.auth.mechanisms","XOAUTH2");props.put("mail.smtp.starttls.enable","true");varsession=Session.getDefaultInstance(props);// メールを作成varmessage=newMimeMessage(session);message.setFrom(newInternetAddress(MAIL_FROM));message.setRecipient(Message.RecipientType.TO,newInternetAddress(MAIL_TO));message.setSubject("Gmail から送信したメール");message.setText("このメールは、Gmail の SMTP で OAuth 2.0 認証を使って送信しました。");// メールを送信vartransport=session.getTransport("smtp");transport.connect(MAIL_FROM,credential.getAccessToken());transport.sendMessage(message,message.getAllRecipients());transport.close();System.out.println("メールを送信しました。");}}