首页 \ 问答 \ 在eclipse中设置maven java项目[关闭](Setup maven java project in eclipse [closed])

在eclipse中设置maven java项目[关闭](Setup maven java project in eclipse [closed])

如何让Eclipse管理由maven构建的项目的类? 我目前正在使用eclipse的Spring Tool Suite发行版,而我正在研究的项目使用maven项目根pom和一些我不想修改的pom子模块。


How can I make Eclipse manage the classes of a project built by maven? I'm currently using the Spring Tool Suite distribution of eclipse, and the project I'm working on uses a maven project root pom and a number of pom submodules which I wouldn't like to modify.


原文:https://stackoverflow.com/questions/27061716
更新时间:2023-08-02 21:08

最满意答案

你确定你在两个项目中使用相同的jar吗?

Android的org.json.JSONObject.toString(String)是不同的:

/**
 * Returns the value mapped by {@code name} if it exists, coercing it if
 * necessary, or throws if no such mapping exists.
 *
 * @throws JSONException if no such mapping exists.
 */
public String getString(String name) throws JSONException {
    Object object = get(name);
    String result = JSON.toString(object);
    if (result == null) {
        throw JSON.typeMismatch(name, object, "String");
    }
    return result;
}

JSON.toString(Object)

static String toString(Object value) {
    if (value instanceof String) {
        return (String) value;
    } else if (value != null) {
        return String.valueOf(value);
    }
    return null;
}

在你的情况下,这不会在Android上引发异常。


Are you sure you are using the same jar in both projects?

Android's org.json.JSONObject.toString(String) is different:

/**
 * Returns the value mapped by {@code name} if it exists, coercing it if
 * necessary, or throws if no such mapping exists.
 *
 * @throws JSONException if no such mapping exists.
 */
public String getString(String name) throws JSONException {
    Object object = get(name);
    String result = JSON.toString(object);
    if (result == null) {
        throw JSON.typeMismatch(name, object, "String");
    }
    return result;
}

JSON.toString(Object):

static String toString(Object value) {
    if (value instanceof String) {
        return (String) value;
    } else if (value != null) {
        return String.valueOf(value);
    }
    return null;
}

In your case this would not throw an exception on Android.

相关问答

更多
  • Arrays.asList被定义为具有参数T... ,并且主体将它看作T[]类型的一个参数。 但是, T 必须是引用类型 (如任何类型参数),并且int不是引用类型。 因此,没有办法使new int[]{...}与可变参数的数组兼容。 (结果将是List ,这是不允许的。)唯一的选择是将它作为单个对象处理,因此这里的T将是int[] ,它是一个引用类型,函数将返回List 。 我认为这是原因,但我仍然需要查找确切的语言。 它可能涉及我没有掌握的类型推理规则。 但是,我确实尝试了这一点 ...
  • 原因在于三元经营者的工作方式。 它总是将两个对象都转换为与这两个对象通用的最接近的超类型。 在你的情况下,它是BaseInterpolator ,因为你的targetSDK版本设置为23 。 但是,由于您的minSDK为14 ,因此演员阵容无法在所有设备上运行。 因此错误。 为了解决这个问题,你可以为这两个对象添加一个TimeInterpolator的显式类型。 The reason is because of the way ternary operators work. It always casts ...
  • 试图避免的情况被称为竞争条件 : http://en.wikipedia.org/wiki/Race_condition 序列的结果 int myColorInt = color.getRGB(); //Statement 1 String myColorName = color.getName(); //Statement 2 取决于在其他线程中执行的此代码线程的时序 。 如果另一个线程在这两个语句之间设置颜色,则存储在myColorName的名称将与myColorName存储的颜色不匹配。 ...
  • 你确定你在两个项目中使用相同的jar吗? Android的org.json.JSONObject.toString(String)是不同的: /** * Returns the value mapped by {@code name} if it exists, coercing it if * necessary, or throws if no such mapping exists. * * @throws JSONException if no such mapping exists. * ...
  • 您的问题的答案是: 不 ,这不是Java或Android中的错误。 记录良好的行为。 Calendar实例的字段数多于YEAR,MONTH和DATE。 您生成新的日历实例并仅更改这些字段,将所有其他字段保留为创建方式。 如果连续两次运行程序,则秒和毫秒将同时更改。 来自JavaDoc : 设置日历字段YEAR,MONTH和DAY_OF_MONTH的值。 保留其他日历字段的先前值。 如果不需要,请先调用clear() 。 为了每次都打印相同的值,您需要这样做: Calendar calendar1 = ...
  • 如果你看一下第一个循环中arr会发生什么,那就很明显了。 int[] arr = {1, 2, 3, 4}; for (int i : arr) { System.out.println("i = " + i); arr[i] = 0; System.out.println("arr = " + Arrays.toString(arr)); } for (int i : arr) { System.out.pr ...
  • BufferedImage.getRGB()方法始终在非线性 sRGB颜色空间( ColorSpace.CS_sRGB )中返回颜色(作为“压缩格式”中的int )。 无论您的图像具有什么颜色空间和每像素位等,它都会这样做。 因此,可能发生转换和可能的精度损失。 来自JavaDoc : 返回默认RGB颜色模型(TYPE_INT_ARGB)和默认sRGB颜色空间中的整数像素。 如果此默认模型与图像ColorModel不匹配,则会进行颜色转换。 您的TYPE_BYTE_GRAY图像在内部使用线性灰色空间( Co ...
  • Assoc-in使用assoc来修改所提供密钥的元素(在您的情况下为索引)。 Assoc-in(和assoc)尝试创建所需的键(或索引)。 关联向量的特殊处理在assoc docstring中提到: 应用于向量时,返回包含val的索引的新向量。 注 - 索引必须是<=(计数向量) 。 更新:只是为了澄清:缺少的异常是一致的,因为0是空向量中新元素的有效索引,1不是。 Assoc-in uses assoc to modify the element at the supplied key (index in ...
  • 局部变量out_h,out_s,out_v未初始化,因此行为未定义。 ushort out_h, out_s, out_v; 如果你将它们初始化为0,我认为问题应该消失了。 Local variable out_h, out_s, out_v are not initialized, so the behavior is undefined. ushort out_h, out_s, out_v; If you initialize them to be 0, I think the problem s ...
  • 该错误表明在您的设备(或模拟器)上运行的代码,在onCreate()方法的EditorActivity.java的第31行,您正在尝试强制转换为ImageView,但您拥有的是GLSurfaceView。 Caused by: java.lang.ClassCastException: android.opengl.GLSurfaceView cannot be cast to android.widget.ImageView at com.example.ekalips.EditorActivity.on ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。