akhikhl / gretty

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

Can no longer import javax.servlet.annotation.WebServlet #324

Closed markaren closed 7 years ago

markaren commented 7 years ago

Hi, have been using the apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin' statement in my build file, today my project will no longer build because of the update.
The problem is that I can no longer import javax.servlet.annotation.WebServlet In the build file, it is marked as an providedCompile 'javax.servlet:servlet-api:2.5'.

What has changed in this update?

akhikhl commented 7 years ago

@markaren , there wa no change directly related to WebServlet annotation in Gretty 1.4.1. Could you, please, provide a toy project, allowing to reproduce the problem? I'll try to fix it ASAP.

markaren commented 7 years ago

Actually, it seems I cant use apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin' at all.

I get:

could not set unknown property 'port' for object of type org.akhikhl.gretty.GrettyExtension.

Both using gradle 3.3 from command line and through NetBeans plugin. It worked yesterday.

Using:

`buildscript { repositories { jcenter() }

dependencies { 
    classpath 'org.akhikhl.gretty:gretty:1.4.0'
}

}

repositories { jcenter() }

apply plugin: 'org.akhikhl.gretty'`

works though..

Entire problematic buildscript:

` apply plugin: 'java' apply plugin: 'war'

sourceCompatibility = '1.8' [compileJava, compileTestJava].options.encoding = 'UTF-8'

// your own implementation. if (!hasProperty('mainClass')) { ext.mainClass = 'test.gretty' }

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

gretty { port = 8080 contextPath = '/vico-web' servletContainer = 'jetty9' }

repositories { mavenCentral() }

dependencies {

providedCompile 'javax.servlet:servlet-api:2.5'

compile group: 'javax.inject', name: 'javax.inject', version: '1'

compile group: 'com.sun.faces', name: 'jsf-api', version: '2.2.13'
compile group: 'com.sun.faces', name: 'jsf-impl', version: '2.2.13'

compile group: 'org.primefaces', name: 'primefaces', version: '6.0'
compile group: 'org.atmosphere', name: 'atmosphere-runtime', version: '2.4.7'

compile group: 'org.glassfish.web', name: 'javax.el', version: '2.2.6'

testCompile group: 'junit', name: 'junit', version: '4.10'

} `

akhikhl commented 7 years ago

It seems that deprecated-annotation interfered with property delegation in GrettyExtension class. Please fix the problem by replacing port to httpPort.

markaren commented 7 years ago

Using httpPort instead of port fixes the issue. Seems the missing dependecy was just a side effect. Since it was provided by the container, and the build failed early, it was never provided.