saladinkzn / gretty

Advanced gradle plugin for running web-apps on jetty and tomcat.
MIT License
2 stars 2 forks source link

Allow farm/webapp task to include dependencies from repo #13

Closed wcrowell closed 8 years ago

wcrowell commented 8 years ago

This issue is a possible duplicate of [https://github.com/akhikhl/gretty/issues/72].

With the farm/webapp task you cannot include additional dependencies other than what is in the maven dependency. Even if the webapp has a gradle.build, the user may not have access to add an additional dependency.

To work around this issue, I had to do download the dependency and add it to the classpath of the webapp:

farm { webapp "org.jasig.cas:cas-server-webapp:$cas_version", contextPath: '/cas', inplace: true, classPath: ["${project.projectDir}/etc/jars/cas-server-support-rest-4.2.1.jar"] ... }

These additional dependencies add behavior to the webapp that have been left out because the majority of users do not use this functionality.

I would like to do something like this:

farm { webapp "org.jasig.cas:cas-server-webapp:$cas_version", contextPath: '/cas', inplace: true, dependencies { "org.jasig.cas:cas-server-support-rest:4.2.1" } ... }

saladinkzn commented 8 years ago

Hello, I'll try to implement this feature.

saladinkzn commented 8 years ago

I've added this feature into current snapshot:

farm {
    webapp "ru.shadam.gretty.test:test-webapp:1.0", contextPath: '/test', inplace: true , dependencies: [ "com.google.guava:guava:19.0" ]
}

Do not forget to add

  maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }

in repositories section (both in buildscript {} and your project's) Run gradle with --refresh-dependencies if your snapshot was not updated automatically.

wcrowell commented 8 years ago

I will attach this to the issue, but I wanted to email you.

It failed. I ran:

`gradle --refresh-dependencies clean farmIntegrationTest build.gradle.txt settings.gradle.txt gradle.properties.txt

`

I am running with 1.2.6-SNAPSHOT from the oss.jfrog.org artifactory that is the May 26th build: [http://oss.jfrog.org/oss-snapshot-local/ru/shadam/gretty/gretty/1.2.6-SNAPSHOT/gretty-1.2.6-20160526.001410-15.jar]

I do have an included webapp that is in the project that did work with 1.2.4 and 1.2.5. I may be missing something in the webapp line that contains the protected-web-app (problem line is in bold):

… farm { webapp "org.jasig.cas:cas-server-webapp:$cas_version", contextPath: '/cas', inplace: true, dependencies: [ "org.jasig.cas:cas-server-support-rest:4.2.1" ] webapp "org.jasig.cas:cas-management-webapp:$cas_version", contextPath: '/cas-services', inplace: true webapp ':protected-web-app'

Here is the output:

gradle --refresh-dependencies clean farmIntegrationTest

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':protected-web-app'.
> Could not find matching constructor for: org.akhikhl.gretty.ProductConfigurer(org.gradle.api.internal.project.DefaultProject_Decorated, java.io.File, java.lang.String, org.akhikhl.gretty.ProductExtension_Decorated)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 15.268 secs

I am attaching build.gradle, settings.gradle, and gradle.properties.

saladinkzn commented 8 years ago

I can suggest you to remove

apply from: 'https://raw.github.com/saladinkzn/gretty/master/pluginScripts/gretty.plugin'

line from your build.gradle. It's really not nessessary if you're using buildscript {} just add apply plugin: 'org.akhikhl.gretty' instead.

As for the bug it looks like version clash in classpath that removing apply from: can fix. Can your provide gradlew buildEnvironment and gradlew dependencies output?

saladinkzn commented 8 years ago

Fixed in shapshot