vaadin8是一个使用纯java编写的ui框架,提供了很好的ui组件,支持编写liferay7的portlet。
在liferay workspace中,创建一个liferay模块工程,类型是portlet。
1、build.gradle
plugins {
id "fi.jasoft.plugin.vaadin" version "1.1.12"
id "java"
}
vaadinClassPathJar.enabled = false
vaadinSourcesJar.enabled = false
vaadinJavadocJar.enabled = false
war.enabled = false
artifacts {
archives jar
}
vaadin {
version "8.2.0"
}
//def vaadinRepo = "https://maven.vaadin.com/vaadin-prereleases" //TODO use this for Vaadin prereleases
def vaadinRepo = "https://repo1.maven.org/maven2" //TODO use this for released Vaadin 8.2
repositories {
mavenCentral()
maven {
url "https://maven.vaadin.com/vaadin-prereleases"
}
}
dependencies {
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
compileOnly group: "javax.servlet", name: "javax.servlet-api", version: "3.1.0"
compileOnly group: "org.osgi", name: "osgi.cmpn", version: "6.0.0"
compileOnly group: "com.vaadin", name: "vaadin-themes", version: vaadin.version
compileOnly group: "com.vaadin", name: "vaadin-shared", version: vaadin.version
compileOnly group: "com.vaadin", name: "vaadin-server", version: vaadin.version
compileOnly group: "com.vaadin", name: "vaadin-osgi-integration", version: vaadin.version
compileOnly group: "com.vaadin", name: "vaadin-liferay-integration", version: vaadin.version
}
task installLiferayDependencies() << {
def allDeps =
[
"https://repo1.maven.org/maven2/org/jsoup/jsoup/1.8.3/jsoup-1.8.3.jar",
"https://repo1.maven.org/maven2/com/vaadin/external/gentyref/1.2.0.vaadin1/gentyref-1.2.0.vaadin1.jar"
]
[
"vaadin-shared",
"vaadin-server",
"vaadin-osgi-integration",
"vaadin-client-compiled",
"vaadin-themes",
"vaadin-liferay-integration"
].each { dep -> allDeps << vaadinRepo + "/com/vaadin/" + dep + "/" + vaadin.version + "/" + dep + "-" + vaadin.version + ".jar" }
allDeps.each { url ->
javaexec {
main = "-jar";
args = [
"../../blade.jar",
"sh",
"start",
url
]
}
}
}
task uninstallLiferayDependencies() << {
def allDeps =
[
"org.jsoup",
"com.vaadin.external.gentyref",
"com.vaadin.shared",
"com.vaadin.server",
"com.vaadin.osgi.integration",
"com.vaadin.client-compiled",
"com.vaadin.themes",
"com.vaadin.liferay.integration"
]
allDeps.each { symbolicName ->
javaexec {
main = "-jar";
args = ["../../blade.jar", "sh", "uninstall", symbolicName]
}
}
}
ext {
generatedVaadinWebapp = "${buildDir}/classes/main/"
}
/*
sourceSets {
main {
output.dir(generatedVaadinWebapp)
}
}
*/
vaadinCompile {
// useful stuff to trace
// logging true
// logLevel 'TRACE'
// draftCompile true
// style 'DETAILED'
logging false
draftCompile false
style 'OBF'
strict true
manageWidgetset false
widgetset 'vaadinportlet.portlet.AppWidgetSet'
outputDirectory generatedVaadinWebapp
jvmArgs '-Xmx2G'
}
jar {
dependsOn 'vaadinCompile'
exclude('**/*.java')
exclude('**/*.gwt.xml')
exclude('**/test/**/*.class')
}
2、portlet