提交 61ca5c83 编写于 作者: Y Yiming Liu

Update checkstyle conf

上级 8d374626
......@@ -7,7 +7,7 @@ before_install:
after_success:
- mvn clean cobertura:cobertura coveralls:report
- mvn clean site -X
- mvn clean site
- codecov
branches:
......
......@@ -41,11 +41,7 @@ public class ClientEnvironment {
if (env.get() == null) {
Env resultEnv = Apollo.getEnv();
Properties apolloProperties = null;
try {
apolloProperties = readConfigFile(DEFAULT_FILE, null);
} catch (IOException e) {
throw new IllegalArgumentException("Could not read Apollo properties");
}
apolloProperties = readConfigFile(DEFAULT_FILE, null);
if (apolloProperties != null) {
String strEnv = apolloProperties.getProperty(Constants.ENV);
if (!StringUtils.isBlank(strEnv)) {
......@@ -67,26 +63,38 @@ public class ClientEnvironment {
}
@SuppressWarnings("unchecked")
private Properties readConfigFile(String configPath, Properties defaults) throws IOException {
private Properties readConfigFile(String configPath, Properties defaults) {
InputStream in = this.getClass().getResourceAsStream(configPath);
logger.info("Reading config from resource {}", configPath);
if (in == null) {
// load outside resource under current user path
Path path = new File(System.getProperty("user.dir") + configPath).toPath();
if (Files.isReadable(path)) {
in = new FileInputStream(path.toFile());
logger.info("Reading config from file {} ", path);
}
}
Properties props = new Properties();
if (defaults != null) {
props.putAll(defaults);
}
try {
if (in == null) {
// load outside resource under current user path
Path path = new File(System.getProperty("user.dir") + configPath).toPath();
if (Files.isReadable(path)) {
in = new FileInputStream(path.toFile());
logger.info("Reading config from file {} ", path);
}
}
if (defaults != null) {
props.putAll(defaults);
}
if (in != null) {
props.load(in);
if (in != null) {
props.load(in);
in.close();
}
} catch (Exception e) {
logger.warn("Reading config failed: {}", e.getMessage());
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
logger.warn("Close config failed: {}", e.getMessage());
}
}
}
StringBuilder sb = new StringBuilder();
for (Enumeration<String> e = (Enumeration<String>) props.propertyNames(); e
.hasMoreElements();) {
......
......@@ -2,7 +2,6 @@ package com.ctrip.apollo;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
/**
......@@ -12,7 +11,6 @@ import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
*/
@SpringBootApplication
@EnableEurekaServer
@EnableEurekaClient
public class ServerApplication {
public static void main(String[] args) {
......
......@@ -7,7 +7,7 @@ public class Apollo {
private static Env m_env;
public enum Env {
LOCAL, DEV, FWS, FAT, UAT, LPT, PROD, TOOLS
LOCAL, DEV, FWS, FAT, UAT, LPT, PRO, TOOLS
}
public static void initialize(Env env) {
......
......@@ -29,7 +29,7 @@ public class MetaDomainConsts {
public static final String TOOLS =
"http://ws.meta.apollo.fx.tools.ctripcorp.com" + ":" + DEFAULT_PORT;
public static final String PRD = "http://ws.meta.apollo.fx.ctripcorp.com" + ":" + DEFAULT_PORT;
public static final String PRO = "http://ws.meta.apollo.fx.ctripcorp.com" + ":" + DEFAULT_PORT;
private static Map<Env, String> domains = new HashMap<>();
......@@ -41,7 +41,7 @@ public class MetaDomainConsts {
domains.put(Env.UAT, UAT);
domains.put(Env.LPT, LPT);
domains.put(Env.TOOLS, TOOLS);
domains.put(Env.PROD, PRD);
domains.put(Env.PRO, PRO);
}
public static String getDomain(Env env) {
......
......@@ -104,11 +104,11 @@
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
<!--for test -->
<dependency>
<groupId>com.h2database</groupId>
......@@ -161,25 +161,31 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>6.16.1</version>
</dependency>
</dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>6.16.1</version>
</dependency>
</dependencies>
<configuration>
<configLocation>google_checks.xml</configLocation>
<failOnViolation>false</failOnViolation>
<linkXRef>false</linkXRef>
<consoleOutput>true</consoleOutput>
</configuration>
</plugin>
</plugins>
</pluginManagement>
......@@ -203,10 +209,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>google_checks.xml</configLocation>
<failOnViolation>false</failOnViolation>
</configuration>
</plugin>
</plugins>
</build>
......@@ -240,7 +242,7 @@
</build>
</profile>
</profiles>
<repositories>
<repository>
<id>spring-milestones</id>
......@@ -256,10 +258,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>google_checks.xml</configLocation>
<failOnViolation>false</failOnViolation>
</configuration>
</plugin>
</plugins>
</reporting>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册