Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not find any version :) #32

Closed
gaborbernat opened this issue Jun 25, 2014 · 29 comments
Closed

Could not find any version :) #32

gaborbernat opened this issue Jun 25, 2014 · 29 comments

Comments

@gaborbernat
Copy link

So here's the exact error after adding
apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin'.

Could not resolve all dependencies for configuration 'classpath'.
Could not find any version that matches org.akhikhl.gretty:gretty:+.
Required by:
unspecified:unspecified:unspecified

Any ideas what's the problem?

@akhikhl
Copy link
Owner

akhikhl commented Jun 25, 2014

I just fixed it - please try again.
It seems jcenter does not understand '+' notation for the latest version of the component. I will ask.
Thank you for reporting!

@bgaborg
Copy link

bgaborg commented Jul 16, 2014

There is another error (maybe it's related to previous):
In IntelliJ, if I change

apply from: 'https://raw.githubusercontent.com/akhikhl/gretty/master/pluginScripts/gretty9-0.0.20.plugin'
to
apply plugin: 'org.akhikhl.gretty'
the following error pops up when trying to refresh gradle project (build project files):
Error:Cause: groovy.lang.MissingMethodException: No signature of method: org.gradle.api.internal.artifacts.ivyservice.resolutionstrategy.DefaultResolutionStrategy.eachDependency() is applicable for argument types: (org.akhikhl.gretty.SpringBootResolutionStrategy$_resolveDependencyVersions_closure3_closure4) values: [org.akhikhl.gretty.SpringBootResolutionStrategy$_resolveDependencyVersions_closure3_closure4@6087b587]
Possible solutions: eachDependency(org.gradle.api.Action)
No signature of method: org.gradle.api.internal.artifacts.ivyservice.resolutionstrategy.DefaultResolutionStrategy.eachDependency() is applicable for argument types: (org.akhikhl.gretty.SpringBootResolutionStrategy$_resolveDependencyVersions_closure3_closure4) values: [org.akhikhl.gretty.SpringBootResolutionStrategy$_resolveDependencyVersions_closure3_closure4@6087b587]
Possible solutions: eachDependency(org.gradle.api.Action)

@akhikhl
Copy link
Owner

akhikhl commented Jul 16, 2014

Which version of gradle and IntelliJ IDEA?

@bgaborg
Copy link

bgaborg commented Jul 16, 2014

I've tried gradle version 1.11, 1.12 on IntelliJ IDEA 13.1.3
Currently falling back on

apply from: 'https://raw.githubusercontent.com/akhikhl/gretty/master/pluginScripts/gretty9-0.0.20.plugin'

because it works.

@akhikhl
Copy link
Owner

akhikhl commented Jul 16, 2014

OK, I'll have a look at the problem.

@akhikhl akhikhl self-assigned this Jul 16, 2014
@bgaborg
Copy link

bgaborg commented Jul 16, 2014

Thanks!

@akhikhl
Copy link
Owner

akhikhl commented Jul 17, 2014

I just tried importing helloGretty project into IntelliJ IDEA 13.1.3 with Gradle 2.0. It imports compiles and runs without errors.
Is upgrade to Gradle 2.0 not a good option for you?

@akhikhl
Copy link
Owner

akhikhl commented Jul 29, 2014

Any new information on this?

@akhikhl akhikhl added the bug label Jul 29, 2014
@bgaborg
Copy link

bgaborg commented Jul 29, 2014

When upgrading to gradle 2 I get the following error in IDEA 13.1.3:

Error:Cause: org.gradle.api.internal.file.copy.DefaultCopySpec$DefaultCopySpecResolver cannot be cast to org.gradle.api.internal.file.copy.CopySpecInternal

It seems like there's an error caused by the ide. (http://forums.gradle.org/gradle/topics/gradle_v2_0_fails_to_refresh_projects_using_intellij)
Maybe an update in IDEA will fix this.

@bgaborg
Copy link

bgaborg commented Jul 29, 2014

I've updated the IDEA to 13.1.4, now it's working with gradle-2.0. Great!

Now I get another exception when trying to run the app:

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':appRun'.
> Unable to find a single main class from the following candidates [ ... classnames with main function ... ]

why is it happening?

@akhikhl
Copy link
Owner

akhikhl commented Jul 29, 2014

On 07/29/2014 11:42 AM, Gabor Bota wrote:

I've updated the IDEA to 13.1.4, now it's working with gradle-2.0. Great!

Now I get another exception when trying to run the app:

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':appRun'.

    Unable to find a single main class from the following candidates [ ... classnames with main function ... ]

why is it happening?


Reply to this email directly or view it on GitHub
#32 (comment).

Could you, please, run it with --stacktrace flag and provide the
resulting stack trace?

Best regards,
Andrey Hihlovskiy.

@bgaborg
Copy link

bgaborg commented Jul 29, 2014

I've uploaded the stctrace to pastebin: http://pastebin.com/Jug0HgLe

@akhikhl
Copy link
Owner

akhikhl commented Jul 29, 2014

The error is apparently caused by multiple main classes seen by spring-boot:

Unable to find a single main class from the following candidates [com.gravit
yrd.receng.cp2.util.PasswordGenerator, com.gravityrd.receng.cp2.startembedded.StartApp]
        at org.springframework.boot.loader.tools.MainClassFinder$MainClassesCallback.getMainClass(MainClassFinder.java:3
41)

@akhikhl
Copy link
Owner

akhikhl commented Jul 29, 2014

You can specify conrete main class (for spring boot) via:

gretty {
  springBootMainClass = 'package.ClassName'
}

@bgaborg
Copy link

bgaborg commented Jul 29, 2014

So I should define the jetty main class there?
I would like to run the jetty and deploy the project there, use only with servlets. I don't want to use any of the main classes in the project. That was not an issue in an earlier version.

@akhikhl
Copy link
Owner

akhikhl commented Jul 29, 2014

do you have springBoot=true in your configuration? then you need spring-boot main class - either automatically detected or explicitly specified.
jetty main class is not needed anyway.

@bgaborg
Copy link

bgaborg commented Jul 29, 2014

I don't have a spring-boot enabled project. I have not modified anything at all besides changing to apply plugin: 'org.akhikhl.gretty' from gretty9-0.0.20.plugin.

@bgaborg
Copy link

bgaborg commented Jul 29, 2014

I've defined springBoot=false in gretty config (in the build file).
Still getting the error. I think in the task appRun, there should be no search for startable main class in the project.

@akhikhl
Copy link
Owner

akhikhl commented Jul 29, 2014

Please have a look at this line: https://github.com/akhikhl/gretty/blob/master/libs/gretty/src/main/groovy/org/akhikhl/gretty/StartBaseTask.groovy#L36

This is the only place where SpringBootLauncher is instantiated, and it is clearly instantiated in your case, judging from stacktrace.

Take a look at the condition there: SpringBootLauncher is only used if function ProjectUtils.anyWebAppUsesSpringBoot returns true.

Now take a look at these lines:
https://github.com/akhikhl/gretty/blob/master/libs/gretty/src/main/groovy/org/akhikhl/gretty/ProjectUtils.groovy#L26
and
https://github.com/akhikhl/gretty/blob/master/libs/gretty/src/main/groovy/org/akhikhl/gretty/ProjectUtils.groovy#L179

As you see, gretty assumes you are using spring boot as soon as your project depends on artifacts of group 'org.springframework.boot'.

Now, the main question: if you do gradle dependencies --configuration compile, do you see there that your project depends on anything from 'org.springframework.boot' group?

@bgaborg
Copy link

bgaborg commented Jul 29, 2014

I've created a pastebin for the output: http://pastebin.com/F6ZFcGzF

It seems like the jsonrpc4j lib is using springboot, but I don't think this should be a problem.
I think using springboot should be configurable by the springBoot parameter. Now it's set to false, but the error still occurs.

@bgaborg
Copy link

bgaborg commented Jul 29, 2014

I think I should learn some more Groovy and fix some errors by myself shortly :)

@akhikhl
Copy link
Owner

akhikhl commented Jul 29, 2014

Very good that you found it :)

Could you, please, try excluding spring-boot dependency like this:

configurations {
    compile.exclude group: 'org.springframework.boot'
}

@bgaborg
Copy link

bgaborg commented Jul 29, 2014

It's working now, but it does not seem like a solution, it's rather a hack in my opinion... Am I wrong with this?

Anyway this configuration will stay in the buildfile as long as the project doesn't need sprint-boot...

Thanks for the help!

@akhikhl
Copy link
Owner

akhikhl commented Jul 29, 2014

Well, if your project depends on spring-boot, that should normally mean you are building spring-boot application.
As a compromise (so that both you and me are happy, you - with simplicity, me - with purity) I can suggest the following: springBoot property could support not only true/false, but also special value 'suppress'. The meaning of all three values:

  • springBoot=true : you convert your application to spring-boot. Gretty automatically adds spring-boot dependencies and uses special launcher for it.
  • springBoot=false (the default) : your application is not spring-boot, if it does not have spring-boot dependencies. If you add spring-boot dependencies, then you know what you are doing and it is still spring-boot application.
  • springBoot='suppress' : your application is 100% not spring-boot. If there were spring-boot dependencies, they will be excluded. Some things might not work in this case (you excluded dependencies, thats why)

Your opinion?

@bgaborg
Copy link

bgaborg commented Jul 30, 2014

I think that it should ony test for first level dependencies for springboot by default - so a dependency of a library would not be detected. This would be good, because build won't break on gretty version upgrade. (Is it unavoidable to scan in the whole dependency tree, not just in the first level? Answering my question, in a multi-project build testing the first level would be a problem, because what if the root project's first dependencies doesn't contain spring boot)

If scanning only first level dependencies couldn't work, the method you wrote is a good solution imho.
Thanks for your help again.

@akhikhl
Copy link
Owner

akhikhl commented Aug 27, 2014

Where did you get com.github.briandilley.jsonrpc4j:jsonrpc4j:1.2.1 ?
It seems not to be available via jcenter or maven central.

@Aung2
Copy link

Aung2 commented May 10, 2016

Hi akhikhl ,

I have some problem about below error.

Execution failed for task 'appRunDebug'
org.gretty.jacocoHelper cannot be cast to org.gradle.api.task

Please help me...

@myowintun
Copy link

Hi akhikhl,

I have same problem that

Execution failed for task 'appRunDebug'
org.gretty.jacocoHelper cannot be cast to org.gradle.api.task

Please help me too

@saladinkzn
Copy link
Contributor

Do you use gradle-2.14? Revert to 2.13 if you do. I need some time to port jacocoHelper to version that is compatible with gradle 2.14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants