我有一个批处理文件,它使用maven运行java类,它依赖于tools.jar(来自JDK).
例如:
MVN -f \的pom.xml -e EXEC:java的-Dfile.encoding = "UTF-8" -Dexec.mainClass = MyClass的-Dexec.args ="%1%2%3%4%5%6 %7%8%9"-Dexec.classpathScope = runtime
我的程序使用JDK中的tools.jar,我在maven中添加了一个指向它的系统依赖项.
由于exec:java目标不包含系统依赖项,我想手动从命令行添加依赖项.
虽然我预计它是微不足道的,但我可以找到办法.任何帮助将不胜感激.
谢谢,
Avner
使用ajax我请求一个这样的authenticationID:

这是错误的,因为真正的HTTP-Transfer是这样的:
(顺便说一句:响应类型是"application/json; charset = UTF-8")
我看到之间发生了冲突
-1369082024195183657 and
-1369082024195183600
Run Code Online (Sandbox Code Playgroud)
如何防止四舍五入或是一个错误?
我有一个文件
/user/guest/work/test/src/main/java/Test.java
Run Code Online (Sandbox Code Playgroud)
和一个文件对象:
File f = new File("/user/guest/work/test/src/main/java/Test.java");
Run Code Online (Sandbox Code Playgroud)
我需要这个输出
System.out.println(f); -> src/main/java/Test.java
System.out.println(f.getAbsolutePath()); -> /user/guest/work/test/src/main/java/Test.java
Run Code Online (Sandbox Code Playgroud)
我试过:
File relativeTo = new File("/user/guest/work/test");
new File(relativeTo.toURI().relativize(f.toURI()));
Run Code Online (Sandbox Code Playgroud)
但它正在抛出一个
java.lang.IllegalArgumentException: URI is not absolute
at java.io.File.<init>(File.java:416)
at Test.<init>(Test.java:43)
Run Code Online (Sandbox Code Playgroud)
如何获得所需的输出?
我使用此方法将客户端证书注册到服务器证书中.
/**
* Links the user's certificate into the server's keystore/truststore.
*
* @param server
* The server party.
* @return <code>true</code> if the certificate has been bound,
* <code>false</code> if the certificate already was bound to the
* truststore.
* @throws KeyStoreException
*/
public boolean linkToServerCertificate(Party server) throws KeyStoreException {
if (keyAlias.equals(server.keyAlias)) {
throw new IllegalArgumentException("The alias of client and server must be different!");
}
keystore.setCertificateEntry(server.keyAlias, server.getAliasCert());
Certificate certificate = keystore.getCertificate(keyAlias);
server.keystore.setCertificateEntry(keyAlias, certificate);
return true;
}
Run Code Online (Sandbox Code Playgroud)
重新启动AS后,我收到以下消息:
有环境变量JAVA_OPTS =" …
I like to generate images from .puml files in a maven project.
What i do not like to archivee is a hard binding between the project and the library that generates the images. So I like to use this build command:
mvn com.github.jeluard:plantuml-maven-plugin:1.2:generate \
-Dplantuml.outputDirectory=target \
-Dplantuml.sourceFiles={*.puml}
Run Code Online (Sandbox Code Playgroud)
So the third line fills the sourceFiles-class-variable
Unfortunately the syntax {*.puml} seems to be wrong:
[INFO] --- plantuml-maven-plugin:1.2:generate (default-cli) @ test ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.047 …Run Code Online (Sandbox Code Playgroud) 将单例注入原型bean的类加载行为会是什么?
我尝试过以其他方式在单例中注入原型并使用查找方法解决问题。
如果应该调试由 gradle 运行的应用程序,则添加参数
--debug-jvm
Run Code Online (Sandbox Code Playgroud)
调试器将启动一个 jpda-server(因为 server=yes)并挂起直到 eclipse(或其他)附加到套接字。
反过来怎么做?如何告诉 gradle-bootrun 附加到 eclipse-jpda-server?
我试图设置这样的选项:
bootRun {
jvmArgs=["-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:5005"]
}
Run Code Online (Sandbox Code Playgroud)
但是出现异常:
* What went wrong:
Execution failed for task ':bootRun'.
> The value for property 'enabled' is final and cannot be changed any further.
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':bootRun'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:205)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:263)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:203)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:184)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:114) …Run Code Online (Sandbox Code Playgroud) 我编写了一个自定义 Maven 插件,可以从自定义模式构建 Java 代码。
项目结构是这样的:
Project
+ plugin
+ web-application
Run Code Online (Sandbox Code Playgroud)
反应器首先编译插件,然后编译应用程序。
通常的 mvn 命令是:
mvn
Run Code Online (Sandbox Code Playgroud)
...谁触发了<defaultGoal>plugin:scaffold package</defaultGoal>
在新机器上,构建失败,因为在 Reactor 计划构建阶段时插件尚不可知。所以我得mvn install先打电话。然后mvn plugin:scaffold package就像魅力一样发挥作用。
问题是:每当我修改脚手架插件并调用mvn plugin:scaffold package脚手架插件的修改时,尚未使用它,因为它尚未安装到存储库中。所以我得mvn install先再打电话。
有没有办法:
一步到位?
我知道构造函数在java中不可继承,我们需要使用super() - super必须是Constructors中的第一个语句.
但为什么我不能使用@Override注释?
例如:
public class Foo extends Point2D.Double {
@Override // The annotation @Override is disallowed for this location
public Foo(){}
}
Run Code Online (Sandbox Code Playgroud)
如果我有一个Foo的实例,我永远不能Point2D.Double.Double()直接打电话!这种行为完全像Overriding!
我有一个奇怪的 JPEG 图像文件 ImageIO.read() 无法加载:
ImageIO.read(new URL("http://nocturne.wmw.cc/a.jpg"));
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
Exception in thread "main" javax.imageio.IIOException: Unsupported Image Type
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:995)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:966)
at javax.imageio.ImageIO.read(ImageIO.java:1448)
at javax.imageio.ImageIO.read(ImageIO.java:1400)
at Main.main(Main.java:23)
Run Code Online (Sandbox Code Playgroud)