我正在开发一个涉及maven,java和clojure的项目.我面临的问题是,我UTF-8在我的clojure源文件中有一些字符,因为我的源代码没有被java编译器正确解释,我有点通过设置环境变量来工作JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8,但我想要的是通过MAVEN传递此属性.
我已经尝试过设置,MAVEN_OPTS=-Dfile.encoding但这似乎不起作用.
我也试过为maven的编译器插件设置配置......这样的事情:
<configuration>
<compilerArgument>-Dfile.encoding=UTF8</compilerArgument>
</configuration>
Run Code Online (Sandbox Code Playgroud)
这也不起作用.
我是在做错事,还是有别的办法.
谢谢,
RD
好的,这里有一些更详细的信息.这是我的父母pom,
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>UTF-8</encoding> <! also tried <encoding>UTF8</encoding>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
孩子的pom没有什么有趣的事,除了...
<resources>
<resource>
<directory>src/main/clojure</directory>
</resource>
</resources>
Run Code Online (Sandbox Code Playgroud)
;; clojure代码片段会导致问题
(let [char "?"]
(not (empty? (filter #(s/contains? % char) <some-list>)))
;; The list is always empty because I never find a match if I do not set the env. variable
Run Code Online (Sandbox Code Playgroud) 基本上我的响应标头包含
编码传输分块=,
预告片= [我要发送的一些预告片说例如"SomeTrailer"]
一旦我完成了将数据写入Servlet输出流,我正在编写预告片"SomeTrailer:[value]",但这并没有被httpclient正确解析.httpclient将整个输入流(包括预告片)视为单个块.我已经尝试在将数据写入输出流后在响应头中编写预告片,但没有成功.
请帮忙
我没有找到任何好的消息来源.
这是我面临的问题.在运行下面的代码时,我有时会在打印B的内容时收到过时的数据.我无法理解为什么会发生这种情况,因为更新和接收B的内容受B锁的保护.
请注意,在更新到B期间,A和B的锁都被保留.访问B的内容时,只保留一个锁.
另请注意,B.updated()未同步,但我不认为这是问题,因为我确保更新的计数器设置为2,然后才访问B的内容.
class B {
Object data
int updated = 0
// get and set protected by B's monitor
synchronized Object getData() {
return data;
}
synchronized setData(Object d) {
data = d;
updated += 1;
}
// deliberately not synchronized
int updated() { return updated; }
}
class A {
B b
A() {
new Thread t = new Thread(new UpdaterThread());
t.start();
}
// when B is updated both A and B monitors are held
synchronized String setB(Object …Run Code Online (Sandbox Code Playgroud) java ×3
clojure ×1
concurrency ×1
encoding ×1
httpclient ×1
locks ×1
maven-2 ×1
servlets ×1
utf-8 ×1
visibility ×1