Open SpyrosKou opened 6 years ago
A workaround for the gradle plugin beeing unable to run the war, was to use the vaadin gradle plugin to create the war and then the maven jetty plugin to run it.
The pom.xml and the gradle task definition are provided below.
Gradle Task
task runTestWar(dependsOn: war){
description 'Run war in a Jetty Server. Will stop already running Jetty.'
group 'build'
doLast {
exec {
executable('cmd')
args('/c')
args(mavenCommand)
args('jetty:stop')
}
exec {
executable('cmd')
environment('MAVEN_OPTS',MAVEN_OPTS)
args('/c')
args(mavenCommand)
args('jetty:deploy-war')
}
}
}
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>a.group.id</groupId>
<artifactId>artifactId</artifactId>
<version>0.1</version>
<name>Run artifactId</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>mavencentral</id>
<url>http://repo1.maven.org/maven2/</url>
</repository>
</repositories>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.11.v20180605</version>
<dependencies>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>
</dependencies>
<configuration>
<war>${project.basedir}/build/libs/artifact.war</war>
<scanIntervalSeconds>10</scanIntervalSeconds>
<daemon>false</daemon>
<stopPort>9001</stopPort>
<stopKey>stop</stopKey>
<stopWait>30</stopWait>
<httpConnector>
<!--host>localhost</host -->
<port>8080</port>
</httpConnector>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>test-compile</phase>
<goals>
<goal>deploy-war</goal>
</goals>
</execution>
<execution>
<id>stop-jetty</id>
<phase>test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I believe I have the same problem with the vaadinCompile
and vaadinThemeCompile
tasks.
If I try to run gradle vaadinThemeCompile
or vaadinCompile
I get:
Project 'XXX' not found in project ':modules:XXX'. (caused by
org.gradle.execution.taskpath.ProjectFinderByTaskPath$ProjectLookupException`).
However, if I add those as a dependency for the jar
task:
jar.dependsOn("vaadinThemeCompile")
jar.dependsOn("vaadinCompile")
I can do a gradle jar
(inside my modules/XXX
directory) without a problem.
If it helps to solve this issue, I can provide a link to the project having this problem for easy review.
I'm using Gradle 5.5.1 but went back several versions (down to 5.0), just in case, and the problem persists.
I have a multi-project gradle project in Eclipse.
The project basic consists of a parent project 'ParentProject' and several sub projects. The only project with subprojects is 'ParentProject', so no subproject has a subproject. When executing the 'war' task 'subprojectX' is build OK and when deployed it runs OK. However trying to run it with 'VaadinRun' fails throwing the following error :
The build.gradle of subProjectX is the following:
I am using the following versions:
Is it possible that since war can run OK that this is somehow related with the plugin? Any advice would help. If more information are needed feel free to ask. Another information that might help: 'subProjectX' is not mentioned in any build.gradle file.