将AspectJ添加到pom.xml改为使用Maven的Java版本,为什么?

更新:这是我的maven-compiler-plugin配置: org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.6 1.6 我在使用Maven构建的多项目应用程序上工作。 我们决定添加AspectJ,所以我将以下代码添加到顶级项目中的pom.xml :(来自官方文档) … … org.aspectj aspectjrt 1.7.3 … … org.codehaus.mojo aspectj-maven-plugin 1.5 compile test-compile … … 以及每个下属项目的以下片段: … …. … org.codehaus.mojo aspectj-maven-plugin … org.aspectj aspectjrt …. … 不知怎的,这个修改已经覆盖了我使用的Java版本。 如果我运行build我会得到多个这样的错误: 语法错误,注释仅在源级别为1.5或更高时可用 这让我怀疑我的Java版本(原来是1.6)以某种方式还原为1.4。 我什么也没做 – 至少不是故意的 – 可能影响Java版本,所以我怀疑上面提到的AspectJ相关代码负责改变。 我的问题是AspectJ如何改变Java版本以及如何解决这个问题。 或者我是否完全误解了一些事情,我是否走错了路?

Velocity无法找到资源

出了点问题,非常令人沮丧。 我在velocity的主页上读到,当我运行webapp时,应该设置一些属性。 我已经做到了,但无论我做什么,我都会遇到同样的错误。 这是我设置道具和使用速度的地方 public class ConfirmationMailGenerator implements MailGenerator { private BasicUser user; private String htmlTemplate = “HTMLConfirmationMailTemplate.vsl”; private String plainTemplate = “PlainConfirmationMailTemplate.vsl”; public ConfirmationMailGenerator(BasicUser user) { this.user = user; } public StringWriter generateHTML() throws Exception { Properties props = new Properties(); props.setProperty(“resource.loader”, “wepapp”); props.setProperty(“webapp.resource.loader.class”, “org.apache.velocity.tools.view.WebappResourceLoader”); props.setProperty(“webapp.resource.loader.path”, “/WEB-INF/mailtemplates/”); VelocityEngine engine = new VelocityEngine(props); VelocityContext context […]

有没有办法将UTF-8与app引擎一起使用?

我正在寻找关于app引擎如何处理字符编码的一些解释。 我正在研究服务器在应用程序引擎上的客户端 – 服务器应用程序。 这是一个从头开始构建的新应用程序,因此我们在任何地方都使用UTF-8。 客户端通过POST,x-www-form-urlencoded向服务器发送一些字符串。 我收到它们并回复它们。 当客户端收回它时,它是ISO-8859-1! 在POST到blobstore时我也看到了这种行为,参数发送为UTF-8,multipart / form-data编码。 为了记录,我在Wireshark中看到了这一点。 所以我100%确定我发送UTF-8并获得ISO-8859-1。 另外,我没有看到mojibake:ISO-8859-1编码的字符串非常好。 这也不是误解内容类型的问题。 这不是客户。 一路走来正确地认识到我正在发送UTF-8参数,但由于某种原因正在将它们转换为ISO-8859-1。 我认为ISO-8859-1是GAE servlet的默认字符编码。 我的问题是,有没有办法告诉GAE不要转换为ISO-8859-1而是在任何地方使用UTF-8? 假设servlet做了这样的事情: public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType(“application/json”); String name = req.getParameter(“name”); String json = “{\”name\”:\”” + name + “\”}”; resp.getOutputStream().print(json); } 我尝试设置响应的字符编码并请求“UTF-8”,但这并没有改变任何东西。 提前致谢,

使用PrimeFaces动态生成制表符

嗨,我想迭代一个person-object列表,并在每个人的标签中显示数据。 我试过了: 这不起作用。 任何帮助赞赏 马塞尔

Java中的inheritance真的发生了什么?

假设我有两个类Parent和Child ,而Childinheritance自Parent 。 我在Parent有三种方法,其中两种是公共的,一种是私有的。 通常我们说所有非私有方法都被inheritance到Child类中,但我对确切发生的事情感到困惑。 Java是否在Child类中复制了这些方法,还是使用某种引用来维护关系? class Parent{ // Private method private void method1(){ System.out.println(“In private method of Parent class”); } void method2(){ // calling private method method1(); } void method3(){ // calling private method method1(); } } class Child extends Parent{ } class MainClass{ public static void main(String[] args){ Child child = new Child(); […]

如何使用Selenium WebDriver和Java从图像(validation码)中读取文本

我有注册网页,但在最后validation码显示.. 我无法从图像中读取文本。 我要提一下代码和输出.. @Test public void loginTest() throws InterruptedException { System.out.println(“Testing”); driver.get(“https://customer.onlinelic.in/ForgotPwd.htm”); WebElement element = driver.findElement(By.xpath(“//*[@id=’forgotPassword’]/table/tbody/tr[5]/td[3]/img”)); System.out.println(” get the instance “); String elementTest = element.getAttribute(“src”); System.out.println(“Element : ” + elementTest); } 输出:错误 线程“main”中的exceptionorg.openqa.selenium.NoSuchElementException:无法定位元素:{“method”:“xpath”,“selector”:“// [@ id =’forgotPassword’] / table / tbody / tr [ 5] / td [3] / img“}命令持续时间或超时:60.02秒有关此错误的文档,请访问: http ://seleniumhq.org/exceptions/no_such_element.html构建信息:版本:’2.35.0′ ,修订版:’8df0c6b’,时间:’2013-08-12 15:43:19’系统信息:os.name:’Windows 7’,os.arch:’amd64’,os.version:’6.1’,java .version:’1.6.0_26’会话ID:5f5b2e1a-56a4-49ad-8fd3-2870747a7768驱动信息:org.openqa.selenium.firefox.FirefoxDriverfunction[{platform […]

如何检查java中的会话已经过期?

有没有其他方法来检查除此之外的会话到期 session.isNew()

非法逃逸字符“\”

我想在链接的末尾得到名称,所以我这样做了 if( invName.substring(j,k).equals(“\”)){ copyf=invName.substring(0,j);} Eclipse表示字符串文字没有被双引号正确关闭 如何将String与此char进行比较?

Java HttpClient改变内容类型?

我正在为我的Android手机构建一个小应用程序,使用非常基本的REST界面将文本消息转发到Web服务器。 我正在使用android 4.0.3 SDK。 我使用Django和Django restframework包在python中开发了webservice。 设置完全开箱即用。 基本上有一个端点接收包含消息信息(发送者,正文,日期)的JSON对象的POST。 我使用cURL使用以下命令测试了该服务: curl -X POST -H ‘Content-Type: application/json’ –data ‘{“sender”:”+xxxxxxxx”, “body”: “test”, “send_date”:”2011-03-20 16:32:02″}’ http://[…]/messages.json 一切正常,我得到了预期的响应: {“body”: “test”, “send_date”: “2011-03-20T16:32:02”, “id”: 25, “sender”: “+xxxxxxxxxx”} 现在我设置了Android应用程序。 它是一个简单的BroadcastReceiver子类,包含一个私有的AsyncTask类: private class httpPost extends AsyncTask { protected JSONObject doInBackground(String… args) { // Create a new HttpClient and Post Header HttpClient httpclient = […]

如何使用基于均方误差的基于像素的图像比较度量来比较java中的图像集?

在我的项目中,我有一组图像。 我需要比较它们。 将来自一个图像的每个像素与数据集中所有其他图像中的相同位置处的像素进行比较。 在对图像空间中的所有像素应用均方误差计算之后,识别一组不同的像素,其表示图像中具有变化的颜色值的像素。 我已经比较并存储了两个图像的文件中的相似像素。但是对于12个图像不能这样做。’code’ import java.io.*; import java.awt.*; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; class spe { public static void main(String args[]) throws IOException { long start = System.currentTimeMillis(); int q=0; File file1 = new File(“filename.txt”); /* if file doesnt exists, then create it if (!file.exists()) { file.createNewFile(); }*/ FileWriter fw = new FileWriter(file1.getAbsoluteFile()); BufferedWriter bw […]