由于我不相信Maven在依赖中介中为我选择"最佳"版本,如果存在未在pom中明确修复的版本冲突(通常使用dependencyManagement),我想使构建失败.
执行器插件的dependencyConvergence规则似乎是我正在寻找的,但不幸的是,它无法处理*-exludes(https://issues.apache.org/jira/browse/MENFORCER-195),所以我无法真正使用它.
有没有其他方法可以阻止Maven应用"最近的依赖性获胜规则",但是让pom的所有者决定使用哪个版本?
我可以将输出显示为Wed May 11 15:36:08 IST 2016,但是如何将日期转换为具有所需格式的字符串?
所需格式为: 12-05-2016 16:05:08 pm
我试过的是
public class Test {
public static void main(String args[]) throws ParseException{
String epoche="1462961108000";
Long initialLogTime = Long.valueOf(epoche);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(initialLogTime);
Calendar fromDateTime = calendar;
Calendar toDateTime = fromDateTime;
toDateTime.add(Calendar.MINUTE, 30);
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy hh:mm:ss:aa");
String datestring = String.valueOf(fromDateTime.getTime());
String datestring1 = String.valueOf(toDateTime.getTime());
System.out.println(datestring); //here output is Wed May 11 15:36:08 IST 2016
System.out.println(datestring1); // here output is Wed May 11 15:36:08 IST 2016 …Run Code Online (Sandbox Code Playgroud) 我试图发布参数并从输入流读取重定向的页面,但我不知道任何此异常
Exception in thread "main" java.lang.IllegalStateException: Already connected
at java.net.URLConnection.setDoOutput(URLConnection.java:900)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.setDoOutput(HttpsURLConnectionImpl.java:455)
at com.company.Main.main(Main.java:58)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Run Code Online (Sandbox Code Playgroud)
码:
try {
CookieHandler cookieHandler = null;
CookieManager.setDefault(cookieHandler);
HttpURLConnection urlConnection = (HttpURLConnection) new URL("site").openConnection();
InputStream i = new BufferedInputStream(urlConnection.getInputStream());
StringBuilder stringBuilder =new StringBuilder();
int c;
while ((c=i.read())!=-1){
stringBuilder.append((char)c);
}
// for getting the post paramters that is user name and password field
Pattern p = Pattern.compile("<input name=\"\\w{22}\" type=\"text\" id=\"\\w{22}\" />");
Matcher matcher = p.matcher(stringBuilder.toString());
String …Run Code Online (Sandbox Code Playgroud) 快速maven -ver查询显示我有一个 amd64 处理器,但我肯定运行的是 i7,如我的系统规格中所示......关于为什么会发生这种情况有什么想法吗?我认为这可能与未正确安装 JDK 有关,但我不认为是这样......