Skip to content

Commit 9bdaf49

Browse files
committed
Convert to maven project & add option for SSL.
1 parent 716fa83 commit 9bdaf49

File tree

9 files changed

+30
-31
lines changed

9 files changed

+30
-31
lines changed

.classpath

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
33
<classpathentry kind="src" path="src"/>
4-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
4+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
55
<attributes>
6-
<attribute name="owner.project.facets" value="java"/>
6+
<attribute name="maven.pomderived" value="true"/>
77
</attributes>
88
</classpathentry>
9-
<classpathentry kind="lib" path="lib/activation-1.1.1.jar"/>
10-
<classpathentry kind="lib" path="lib/commons-email-1.4.jar"/>
11-
<classpathentry kind="lib" path="lib/javax.mail-1.5.2.jar"/>
129
<classpathentry combineaccessrules="false" kind="src" path="/scouter-common"/>
1310
<classpathentry combineaccessrules="false" kind="src" path="/scouter-server"/>
14-
<classpathentry kind="output" path="bin"/>
11+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
12+
<attributes>
13+
<attribute name="maven.pomderived" value="true"/>
14+
</attributes>
15+
</classpathentry>
16+
<classpathentry kind="output" path="target/classes"/>
1517
</classpath>

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@
1212
hs_err_pid*
1313
/bin/
1414
/out/
15+
/target/

.project

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@
1515
<arguments>
1616
</arguments>
1717
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.m2e.core.maven2Builder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
1823
</buildSpec>
1924
<natures>
25+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
2026
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
2127
<nature>org.eclipse.jdt.core.javanature</nature>
2228
</natures>

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
* **_ext\_plugin\_email\_smtp_port_** : SMTP Port - 기본 값은 587
2222
* **_ext\_plugin\_email\_username_** : Email 사용자 계정
2323
* **_ext\_plugin\_email\_password_** : Email 사용자 비밀번호
24-
* **_ext\_plugin\_email\_tls_enabled_** : TLS 사용 여부 - 기본 값은 true
24+
* **_ext\_plugin\_email\_ssl_enabled_** : SSL 사용 여부 - 기본 값은 true
25+
* **_ext\_plugin\_email\_starttls_enabled_** : STARTTLS 사용 여부 - 기본 값은 true
2526
* **_ext\_plugin\_email\_from_address_** : Email 발신자 계정
2627
* **_ext\_plugin\_email\_to_address_** : Email 수신 계정(다중 사용자 지정 시 ',' 구분자 사용)
2728
* **_ext\_plugin\_email\_cc_address_** : Email 참조 수신 계정(다중 사용자 지정 시 ',' 구분자 사용)
@@ -43,7 +44,8 @@ ext_plugin_email_smtp_hostname=smtp.gmail.com
4344
ext_plugin_email_smtp_port=587
4445
4546
ext_plugin_email_password=password
46-
ext_plugin_email_tls_enabled=true
47+
ext_plugin_email_ssl_enabled=true
48+
ext_plugin_email_starttls_enabled=true
4749
4850
4951
@@ -69,7 +71,7 @@ ext_plugin_ignore_continuous_dup_alert=true
6971

7072
### Build & Deploy
7173
* Build
72-
- 프로젝트 내의 build.xml을 실행한다.
74+
- mvn clean package를 실행한다.
7375

7476
* Deploy
75-
- 빌드 후 프로젝트 하위에 out 디렉토리가 생기며, 디펜던시 라이브러리와 함께 scouter-plugin-server-alert-email.jar 파일을 복사하여 스카우터 서버 설치 경로 하위의 lib/ 폴더에 저장한다.
77+
- Maven 빌드 후 target/lib 디렉토리의 디펜던시 라이브러리와 함께 scouter-plugin-server-alert-email-1.0.0.jar 파일을 복사하여 스카우터 서버 설치 경로 하위의 lib/ 폴더에 저장한다.

build.xml

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

lib/activation-1.1.1.jar

-67.8 KB
Binary file not shown.

lib/commons-email-1.4.jar

-50 KB
Binary file not shown.

lib/javax.mail-1.5.2.jar

-558 KB
Binary file not shown.

src/scouter/plugin/server/alert/email/EmailPlugin.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ public void run() {
122122
int port = conf.getInt("ext_plugin_email_smtp_port", 587);
123123
String username = conf.getValue("ext_plugin_email_username");
124124
String password = conf.getValue("ext_plugin_email_password");
125-
boolean tlsEnabled = conf.getBoolean("ext_plugin_email_tls_enabled", true);
125+
boolean sslEnabled = conf.getBoolean("ext_plugin_email_ssl_enabled", true);
126+
boolean tlsEnabled = conf.getBoolean("ext_plugin_email_starttls_enabled", true);
126127
String from = conf.getValue("ext_plugin_email_from_address");
127128
String to = conf.getValue("ext_plugin_email_to_address");
128129
String cc = conf.getValue("ext_plugin_email_cc_address");
@@ -211,7 +212,13 @@ public void run() {
211212
Email email = new SimpleEmail();
212213

213214
email.setHostName(hostname);
214-
email.setSmtpPort(port);
215+
216+
if (sslEnabled) {
217+
email.setSslSmtpPort(Integer.toString(port));
218+
} else {
219+
email.setSmtpPort(port);
220+
}
221+
215222
email.setAuthenticator(new DefaultAuthenticator(username, password));
216223
email.setStartTLSEnabled(tlsEnabled);
217224
email.setFrom(from);

0 commit comments

Comments
 (0)