Groovy / Grails无法仅解析类@ run(Groovy/Grails unable to resolve class only @ run)

编程入门 行业动态 更新时间:2024-10-11 15:20:57
Groovy / Grails无法仅解析类@ run(Groovy/Grails unable to resolve class only @ run)

有一个groovy控制器利用Java SSH包(JSch)与IDE中的NO ISSUES(jar被添加到库,导入工作,所有调用反对类传递)但是我只在run-app上失败:

unable to resolve class JSch @ ... : JSch jsch = new JSch()

我在Java中使用相同的代码而没有SFTP应用程序的任何问题,这甚至不会实例化初始对象,因此不太关心其余的代码。 我尝试过依赖mgmt和刷新没有成功。

我想现在的问题是为什么在没有明显的实现问题时,任何类都无法在运行时解决?

Have a groovy controller leveraging Java SSH package (JSch) with NO ISSUES in IDE (jar was added to library, import works, all calls against class pass) however I get failure only on run-app:

unable to resolve class JSch @ ... : JSch jsch = new JSch()

I use the same code in Java without any issues for an SFTP application and this won't even instantiate the initial object so less concerned about the rest of the code. I've tried mucking with dependency mgmt and refreshing with no success.

I guess the question at hand is why does any class fail to resolve only at run when there are no obvious issues with implementation?

最满意答案

是的... Grails并不会对你在IDE中添加哪些罐子感到遗憾。 Grails使用Maven来解决依赖关系。

下一步

首先要删除JSch jar。 然后,将以下Maven工件添加到项目中: com.jcraft:jsch:0.1.53

当然,根据需要调整版本号。 如何将其添加到Grails取决于您正在使用的Grails版本。

Grails 3

将以下内容添加到build.gradle中的dependencies闭包中:

compile 'com.jcraft:jsch:0.1.53'

Grails 2.4

对于Grails 2.4(可能是早期版本,我根本不知道)在grails-app / config / BuildConfig.groovy中的plugins闭包中添加以下内容

compile 'com.jcraft:jsch:0.1.53'

Yeah... Grails doesn't give a damn about which jars you add with your IDE. Grails uses Maven to resolve dependencies.

Next steps

The first thing is to remove the JSch jar. Then, add the following Maven artifact to your project: com.jcraft:jsch:0.1.53

Of course, adjust the version number as needed. How this is added to Grails depends on the version of Grails you're using.

Grails 3

Add the following to the dependencies closure in build.gradle:

compile 'com.jcraft:jsch:0.1.53'

Grails 2.4

For Grails 2.4 (and maybe earlier versions, I simply don't know) add the following within the plugins closure in grails-app/config/BuildConfig.groovy

compile 'com.jcraft:jsch:0.1.53'

更多推荐

Java,JSch,class,没有,电脑培训,计算机培训,IT培训"/> <meta name="descriptio

本文发布于:2023-07-29 05:50:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1313024.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:run   Grails   Groovy   class   resolve

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!