编译错误 - Redhat中未找到package com.google.gson“Openshift”应用 [英] Compilation error - package com.google.gson not found in Redhat "Openshift" application

查看:346
本文介绍了编译错误 - Redhat中未找到package com.google.gson“Openshift”应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在Web-inf / lib文件夹中添加了gson jar文件,并且它是使用Eclipse Luna开发的使用gson jars的openshift应用程序。在eclipse中没有显示任何错误。



但是,当我将推送并提交应用程序到GIT存储库时,它显示错误:



我也尝试在外部库中添加jar
配置构建路径 - >添加外部jar ....



<
$ b

  [错误]编译错误:
[信息] ----- -------------------------------------------------- ------
[错误] / var / lib / openshift / 54d3ce57fcf933ba9b00000a / app-
root / runtime / repo / src / main / java / com / servlet / Controller_vehicle.java:[14 ,22]
错误:com.google.gson包不存在

openshift不是支持gson包???

解决方案

行!我知道了。
对于您在java openshift应用程序库中添加的任何外部jar,必须在 pom.xml 文件中显示依赖关系
此文件位于webapps文件夹中,即webapps /pom.xml。

我使用了gson-2.1.jar,因此相应的依赖是: -

 <依赖性> 
< groupId> com.google.code.gson< / groupId>
< artifactId> gson< / artifactId>
< version> 2.1< / version>
< /依赖关系>

感谢我:)

I am devleoping application in openshift using Eclipse Luna which make use of gson jars.

I added gson jar files in the Web-inf/lib folder and it is not showing any error in eclipse.

But when I Push and Commit the application to the GIT repository, it is showing error:

I also tried adding jars in the external libraries Configure Build path -> Add external jars....

But still not working !!

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /var/lib/openshift/54d3ce57fcf933ba9b00000a/app-
root/runtime/repo/src/main/java/com/servlet/Controller_vehicle.java:[14,22]
 error: package com.google.gson does not exist

Is openshift not supporting gson packages ???

解决方案

OK ! i got it. For any external jars that you add in the libraries in java openshift application, you have to show the dependency in the pom.xml file This file is in webapps folder i.e. webapps/pom.xml.

I used gson-2.1.jar, so the corresponding dependency is :-

<dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.1</version>
</dependency>

Thanks to me :)

这篇关于编译错误 - Redhat中未找到package com.google.gson“Openshift”应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆