I'm just new to Gradle, and I have a small problem with it. I'm trying to build two projects (called 'infrastructure' and 'domain'), where domain has some imports from infrastructure.
When I try to build both projects, Gradle can't compile my domain project, because he can't find a package from infrastructure.
This is my build.gradle:
subprojects{
apply plugin: 'java'
springversion = '3.0.4.RELEASE'
hibernateversion = '3.4.0.GA'
jsfversion = '2.0.3'
projectid = 'com.companyName.projectName'
projectversion = '1.0.0-SNAPSHOT'
repositories {
mavenRepo urls: 'file:///C:/companyName/m2repo'
mavenCentral()
}
dependencies {
compile group: 'commons-configuration', name: 'commons-configuration', version: '1.6'
compile group: 'sample.plugin', name: 'hsqldb-maven-plugin', version: '1.0-SNAPSHOT'
testCompile group: 'junit', name: 'junit', version: '4.8.2'
testCompile group: 'org.mockito', name: 'mockito-core', version: '1.8.0'
testCompile group: 'org.springframework', name: 'spring-test', version: springversion
compile group: 'org.springframework', name: 'spring-context', version: springversion
compile group: 'org.springframework', name: 'spring-orm', version: springversion
compile group: 'org.springframework', name: 'spring-web', version: springversion
compile group: 'org.hibernate', name: 'hibernate-annotations', version: hibernateversion
compile group: 'org.hibernate', name: 'hibernate-entitymanager', version: hibernateversion
compile group: 'org.hibernate', name: 'ejb3-persistence', version: '1.0.2.GA'
compile group: 'javax.enterprise', name: 'cdi-api', version: '1.0-CR1'
compile group: 'com.sun.faces', name: 'jsf-api', version: jsfversion
compile group: 'commons-lang', name: 'commons-lang', version: '2.5'
runtime group: 'org.slf4j', name: 'slf4j-api', version: '1.5.6'
runtime group: 'org.slf4j', name: 'slf4j-jdk14', version: '1.5.6'
runtime group: 'org.hsqldb', name: 'hsqldb', version: '1.8.0.10'
runtime group: 'commons-dbcp', name: 'commons-dbcp', version: '1.2.2'
runtime group: 'org.aspectj', name: 'aspectjweaver', version: '1.6.2'
}
}
project (':infrastructure'){
task intTestJar(type: Jar) {
from sourceSets.main.classes
from sourceSets.test.classes
}
}
project(':domain'){
compileJava.dependsOn (':infrastructure:intTestJar')
}
In my settings.gradle, I've declared this:
include 'infrastructure', 'domain'
Both projects should be built to a .jar file.
When try to build the projects, this error is shown when he is running domain:compileTestJava
package com.companyName.projectName.test does not exist
This package refers to my infrastructure project. In eclipse it works, but I can't build it with gradle.
Any help would be appreciated.
Regards,
Walle
This did the trick:
subprojects{
apply plugin: 'java'
apply plugin: 'eclipse'
springversion = '3.0.4.RELEASE'
hibernateversion = '3.4.0.GA'
jsfversion = '2.0.3'
projectid = 'com.companyName.projectName'
projectversion = '1.0.0-SNAPSHOT'
repositories {
mavenRepo urls: 'file:///C:/companyName/m2repo'
mavenCentral()
}
dependencies {
compile group: 'commons-configuration', name: 'commons-configuration', version: '1.6'
compile group: 'sample.plugin', name: 'hsqldb-maven-plugin', version: '1.0-SNAPSHOT'
testCompile group: 'junit', name: 'junit', version: '4.8.2'
testCompile group: 'org.mockito', name: 'mockito-core', version: '1.8.0'
testCompile group: 'org.springframework', name: 'spring-test', version: springversion
compile group: projectid, name: 'infrastructure', version: projectversion
compile group: projectid, name: 'domain', version: projectversion
compile group: 'org.springframework', name: 'spring-context', version: springversion
compile group: 'org.springframework', name: 'spring-orm', version: springversion
compile group: 'org.springframework', name: 'spring-web', version: springversion
compile group: 'org.hibernate', name: 'hibernate-annotations', version: hibernateversion
compile group: 'org.hibernate', name: 'hibernate-entitymanager', version: hibernateversion
compile group: 'org.hibernate', name: 'ejb3-persistence', version: '1.0.2.GA'
compile group: 'javax.enterprise', name: 'cdi-api', version: '1.0-CR1'
compile group: 'com.sun.faces', name: 'jsf-api', version: jsfversion
compile group: 'commons-lang', name: 'commons-lang', version: '2.5'
runtime group: 'org.slf4j', name: 'slf4j-api', version: '1.5.6'
runtime group: 'org.slf4j', name: 'slf4j-jdk14', version: '1.5.6'
runtime group: 'org.hsqldb', name: 'hsqldb', version: '1.8.0.10'
runtime group: 'commons-dbcp', name: 'commons-dbcp', version: '1.2.2'
runtime group: 'org.aspectj', name: 'aspectjweaver', version: '1.6.2'
}
test{
maxParallelForks=2
}
}
project(':infrastructure'){
task infrastructureTestJar(type: Jar) {
from sourceSets.main.classes
from sourceSets.test.classes
}
infrastructureTestJar.dependsOn(jar)
}
project(':domain'){
compileJava.dependsOn(':infrastructure:build')
dependencies{
compile files('../infrastructure/build/libs/infrastructure.jar')
}
task domainTestJar(type: Jar) {
from sourceSets.main.classes
from sourceSets.test.classes
}
domainTestJar.dependsOn(jar)
}
Related
I have a shared template that I am referencing in my azure pipeline to Build, Test, Pack, and Publish a C# nuget package.
DotNet-BuildTestPackPublish.yml
parameters:
- name: project
type: string
default: ''
- name: dotnetVersion
type: string
default: '5.0.x'
- name: isNugetPackage
type: boolean
default: false
- name: isFirstProjectInRepo
type: boolean
default: true
steps:
- task: UseDotNet#2
displayName: 'Add .NET ${{parameters.dotnetVersion}}'
condition: and(succeeded(), eq(${{parameters.isFirstProjectInRepo}}, true))
inputs:
packageType: 'sdk'
version: ${{parameters.dotnetVersion}}
- task: NuGetAuthenticate#0
displayName: 'NuGet Auth'
condition: and(succeeded(), eq(${{parameters.isFirstProjectInRepo}}, true))
- checkout: self
persistCredentials: true
displayName: "Git Checkout"
condition: and(succeeded(), eq(${{parameters.isFirstProjectInRepo}}, true))
- task: DotNetCoreCLI#2
displayName: "Build"
inputs:
command: 'build'
projects: '**/*.sln'
- task: DotNetCoreCLI#2
displayName: Unit Test
inputs:
projects: '**/*.sln'
command: 'test'
- task: PowerShell#2
displayName: "Extract Version"
condition: and(succeeded(), eq(${{parameters.isNugetPackage}}, true), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
inputs:
targetType: 'inline'
script: |
Write-Host "Locating Project Path..."
$input_path = (Get-ChildItem -Include ${{parameters.project}}.csproj -File -Recurse)
Write-Host "Project Path = $input_path"
Write-Host "Getting version from csproj..."
$regex = '(?<=<Version>).*?(?=<\/Version>)'
$version = Select-String -Path $input_path -Pattern $regex -AllMatches | % { $_.Matches } | % { $_.Value }
Write-Host "Version = $version"
if([string]::IsNullOrWhiteSpace($version))
{
Write-Host "Version not in csproj. Defaulting to 1.0.0"
$version = "1.0.0"
}
Write-Host "Getting Build Number from Environment"
$buildNumber = '$(Build.BuildId)'
Write-Host "Build Number = $buildNumber"
$versionAndBuildNumber = "$version+$buildNumber"
Write-Host "Package Version = $versionAndBuildNumber"
$tagText = "${{parameters.project}}+$version+$buildNumber"
Write-Host "Tag Text = $tagText"
Write-Output "##vso[task.setvariable variable=gitTag]$tagText"
Write-Output "##vso[task.setvariable variable=versionNumber]$versionAndBuildNumber"
- task: PublishSymbols#2
inputs:
searchPattern: '**/bin/**/${{parameters.project}}.pdb'
symbolServerType: "teamServices"
- task: DotNetCoreCLI#2
displayName: "Nuget Pack"
condition: and(succeeded(), eq(${{parameters.isNugetPackage}}, true), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
inputs:
command: 'pack'
packagesToPack: '**/${{parameters.project}}.csproj'
versioningScheme: byEnvVar
versionEnvVar: versionNumber
includesymbols: true
includesource: true
- task: NuGetCommand#2
displayName: "Nuget Push"
condition: and(succeeded(), eq(${{parameters.isNugetPackage}}, true), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: 'Internal'
allowPackageConflicts: true
- script: |
echo Current Directory:
cd
dir /s
git tag $(gitTag)
git push --tags origin $(gitTag)
workingDirectory: $(Build.SourcesDirectory)
displayName: "Git Tag Repository"
condition: and(succeeded(), eq(${{parameters.isNugetPackage}}, true), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
This works well if there is only one project in my repository:
azure-pipelines.yml (only one project)
trigger:
branches:
include:
- '*'
pool:
vmImage: 'windows-latest'
resources:
repositories:
- repository: BuildScripts
name: Feldryn/BuildScripts
type: git
ref: main
trigger:
- main
variables:
- group: 'Pipeline Shared Variables'
steps:
- template: DotNet-BuildTestPackPublish.yml#BuildScripts
parameters:
project: 'Daemon.Domain.RumbleRunners.Values'
isNugetPackage: true
# the following step is superfluous for this example, but it DOES work
- task: PowerShell#2
displayName: "Replace Project Reference with Nuget"
inputs:
targetType: 'inline'
script: |
cd Daemon.Domain.RumbleRunners
dotnet remove reference ..\Daemon.Domain.RumbleRunners.Values\Daemon.Domain.RumbleRunners.Values.csproj
dotnet add package Daemon.Domain.RumbleRunners.Values
cd..
As soon as I attempt to call the template again in the same pipeline for another project, the first will start failing.
This does not work:
azure-pipelines.yml (two projects)
trigger:
branches:
include:
- '*'
pool:
vmImage: 'windows-latest'
resources:
repositories:
- repository: BuildScripts
name: Feldryn/BuildScripts
type: git
ref: main
trigger:
- main
variables:
- group: 'Pipeline Shared Variables'
steps:
- template: DotNet-BuildTestPackPublish.yml#BuildScripts
parameters:
project: 'Daemon.Domain.RumbleRunners.Values'
isNugetPackage: true
- task: PowerShell#2
displayName: "Replace Project Reference with Nuget"
inputs:
targetType: 'inline'
script: |
cd Daemon.Domain.RumbleRunners
dotnet remove reference ..\Daemon.Domain.RumbleRunners.Values\Daemon.Domain.RumbleRunners.Values.csproj
dotnet add package Daemon.Domain.RumbleRunners.Values
cd..
# the inclusion of following step is the only change
- template: DotNet-BuildTestPackPublish.yml#BuildScripts
parameters:
project: 'Daemon.Domain.RumbleRunners'
isNugetPackage: true
isFirstProjectInRepo: false
It fails with 'fatal: not a git repository (or any of the parent directories): .git' when attempting to git tag the first project.
I've done some troubleshooting and determined:
It's not my git tag step that is at fault.
It works when there is one project
The failure moves to the following step if I comment the git tag step.
New error: Could not find any project in D:\a\1\s\Daemon.Domain.RumbleRunners\.
I've outputted the contents of my working directory and can see all expected files are present, including the .git folder
The working directory is not different between the working and non-working approaches.
I'm at a loss for how to troubleshoot further.
Why can't I call my template twice? What is happening here?
checkout task behaves differently when there are multiple checkouts:
When there's only a single checkout: self step, it will check out the repository to /home/vsts/work/1/s/.
When there are multiple checkout steps (even if they refer to the same repository), it will check out to /home/vsts/work/1/s/{repository_name}.
Even though you have a condition on the second checkout, the step still counts, thus point 2. applies.
To validate this, check logs of checkout task for both scenarios. You can also try a minimal repro pipeline:
steps:
- checkout: self # <-- /home/vsts/work/1/s/
vs
steps:
- checkout: self # <-- /home/vsts/work/1/s/{repo_name}/
- checkout: self # <-- /home/vsts/work/1/s/{repo_name}/
condition: false
I have a Spring Boot Application with gradle as the dependency manager. I have been creating the war file using Export As war file. And have deployed the same in AWS ElasticBeanstalk. The platform I use is Tomcat 8.5 with Java 8 running on 64bit Amazon Linux/3.4.5
Now, I want to use CI/CD of AWS and want to create a Code Pipeline to deploy the war file to EBS.
While creating the Code-Pipeline, it asks me to build the Code Build Project.
Following is my build command :
version: 0.2
#env:
#variables:
# key: "value"
# key: "value"
#parameter-store:
# key: "value"
# key: "value"
#secrets-manager:
# key: secret-id:json-key:version-stage:version-id
# key: secret-id:json-key:version-stage:version-id
#exported-variables:
# - variable
# - variable
#git-credential-helper: yes
#batch:
#fast-fail: true
#build-list:
#build-matrix:
#build-graph:
phases:
#install:
#If you use the Ubuntu standard image 2.0 or later, you must specify runtime-versions.
#If you specify runtime-versions and use an image other than Ubuntu standard image 2.0, the build fails.
#runtime-versions:
# name: version
# name: version
#commands:
# - command
# - command
#pre_build:
#commands:
# - command
# - command
build:
commands:
- gradle build
# - command
#post_build:
#commands:
# - command
# - command
#reports:
#report-name-or-arn:
#files:
# - location
# - location
#base-directory: location
#discard-paths: yes
#file-format: JunitXml | CucumberJson
#artifacts:
#files:
# - location
# - location
#name: $(date +%Y-%m-%d)
#discard-paths: yes
#base-directory: location
#cache:
#paths:
# - paths
What changes do I make here, so that the war file is created and deployed to EBS. Since, I am pretty new to the Build Process and CI/CD, I am a bit confused.
My build.gradle file is :
plugins {
id 'org.springframework.boot' version '2.2.7.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
id 'war'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
annotationProcessor 'org.projectlombok:lombok'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
//compile group: 'org.hibernate', name: 'hibernate-gradle-plugin', version: '5.4.15.Final'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '2.2.7.RELEASE'
compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.20'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.11.0'
compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-mail', version: '2.3.0.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: '2.3.0.RELEASE'
compile group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.11.784'
providedCompile group: 'org.projectlombok', name: 'lombok', version: '0.11.0'
// https://mvnrepository.com/artifact/org.projectlombok/lombok
compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.18'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '4.1.2'
compile group: 'org.apache.poi', name: 'poi', version: '4.1.2'
compile group: 'org.codehaus.mojo', name: 'exec-maven-plugin', version: '3.0.0'
compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
compile group: 'com.google.zxing', name: 'core', version: '3.4.1'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
implementation group: 'com.google.common', name: 'google-collect', version: '0.5'
developmentOnly("org.springframework.boot:spring-boot-devtools")
//testImplementation 'org.springframework.security:spring-security-test'
}
test {
useJUnitPlatform()
}
I came across the same problem a few days ago and I hardly found any good resources for gradle. You can easily deploy your application directly to Elastic Beanstalk by uploading a WAR file generated during the gradle build.
When you upload your WAR file to Beanstalk, it gets extracted/exploded and Beanstalk does this for you internally. But when you use the pipeline, you need to upload the exploded files directly instead of the WAR. It seems that the AWS Codepipeline is still not WAR friendly.
First off, to generate an exploded WAR file, you need to add the following to your build.gradle:
task explodedWar(type: Sync) {
into "${buildDir}/exploded"
with war }
To generate the exploded folder, you need to run the following task through your terminal using the command:
./gradlew explodedWar
You will find a folder named exploded in the build folder where you will be able to see the contents of the exploded WAR.
Here is the following builspec.yml file you can use to build the code and deploy it using the pipeline. The environment used by me is Tomcat 8.5 with Corretto 8 running on 64bit Amazon Linux 2:
version: 0.1
phases:
install:
run-as: root
commands:
- echo Installing gradle
- wget https://services.gradle.org/distributions/gradle-7.1.1-bin.zip
- unzip -d /opt/gradle gradle-7.1.1-bin.zip
pre_build:
commands:
- echo Entering pre build
build:
commands:
- /opt/gradle/gradle-7.1.1/bin/gradle clean
- /opt/gradle/gradle-7.1.1/bin/gradle explodedWar
post_build:
commands:
- echo Entering post build
artifacts:
files:
- '**/*'
base-directory: build/exploded/
discard-paths: no
You can check the AWS buildspec.yml documentation for more syntax and features depending on your use case.
I have created a simple springboot application that just sends a message to SQS. while starting
the app, it is trying to connect to EC2 metadata instance and failing, I tried to set that to false, but it still fails with different error message. Can someone please help me understand what am I missing.
build.gradle file with the dependencies,I tried with multiple spring boot version also
plugins {
id 'org.springframework.boot' version '2.0.5.RELEASE'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
id 'war'
}
group = 'com.springboot.aws.ebs'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencyManagement {
imports {
mavenBom 'com.amazonaws:aws-java-sdk-bom:1.10.47'
//mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
dependencies {
compile 'com.amazonaws:aws-java-sdk-s3'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
compile group: 'com.amazonaws', name: 'aws-java-sdk-core', version: '1.11.890'
compile group: 'com.amazonaws', name: 'aws-java-sdk-sqs', version: '1.11.890'
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-aws', version: '2.1.2.RELEASE'
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-aws-messaging', version: '2.1.2.RELEASE'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
test {
useJUnitPlatform()
}
application.yml file I used to configure the connection details
cloud:
aws:
region:
static: <region>
auto: false
credentials:
access-key: <access key>
secret-key: <secret key>
end-point:
uri: <end-point>
I looked into a few stackoverflow post with the same issue, but none of them helped. thanks in advance for your help.
Error Details
com.amazonaws.SdkClientException: Failed to connect to service endpoint:
it tries to connect to EC2 metadata instance (http://169.254.169.254)
Caused by: java.net.ConnectException: Host is down (connect failed)
I would like to use ansible to check if a package name exist in an output of a command. if not exist do something.
for example :
I'm looking for the package "zip" but the problem is that it return "gzip" "zip" "unzip" and I'm looking to find only "zip" ,how to do it in a when condition
How can I use regex to match the {{ item.name }} exactly and not words that contains part of {{ item.name }}
- name: Check if Package is installed
shell: dpkg-query -f '${binary:Package}\n' -W
register: is_installed
- name: Install apt dependencies
apt:
name: "{{item.name}}{{item.version}}"
state: present
allow_unauthenticated: yes
force: yes
with_items:
- { name: 'python2.7', version: '' }
- { name: 'ruby', version: '' }
- { name: 'postgresql-9.5', version: '' }
- { name: 'postgresql-contrib-9.5', version: '' }
- { name: 'libpq-dev', version: '' }
- { name: 'nodejs', version: '=9.*' }
- { name: 'python-setuptools', version: '' }
- { name: 'python-pip', version: '' }
- { name: 'python-pkg-resources', version: '' }
- { name: 'sshpass', version: '' }
- { name: 'zip', version: '' }
- { name: 'mongodb-org', version: '=4.0.0' }
- { name: 'libfontconfig', version: '' }
- { name: 'ntp', version: '' }
- { name: 'fio', version: '' }
when: not "{{item.name}}" in is_installed.stdout
Am only partially able to test as don't have a Debian based machine in front of me.
You didn't update your Q to show the exact format of the output, so I am not sure if the command is outputting all the packages on a single line, or is outputting one per line.
If one per line, try this:
- name: Install apt dependencies
apt:
name: "{{item.name}}{{item.version}}"
state: present
allow_unauthenticated: yes
force: yes
with_items:
- { name: 'python2.7', version: '' }
- { name: 'ruby', version: '' }
when: not (is_installed.stdout_lines| map('regex_search', '^' + item.name + '$') | select('string') | list | length)
If on multiple lines, then is_installed.stdout_lines will be a list, with one package per item. Therefore we search the list for exact matches, and output the total count of matches. >0 = true.
If all on the same line, then try this instead:
- name: Install apt dependencies
apt:
name: "{{item.name}}{{item.version}}"
state: present
allow_unauthenticated: yes
force: yes
with_items:
- { name: 'python2.7', version: '' }
- { name: 'ruby', version: '' }
when: not (is_installed.stdout | search('(^| )' + item.name + '( |$)')
In this case, we need to search for the name either at the beginning of the line or preceded by a space, and then followed by a space or the end of the line, for an exact match.
Try modifying your regex like below
when: not (?<![\w\d]){{item.name}}(?![\w\d]) in is_installed.stdout
I am pretty new to gradle and build systems,
I am trying to build project with gradle, but it cannot find packages of Tomcat server that I use in several classes of my project.
My build config:
apply plugin: 'java'
apply plugin: 'war'
repositories {
flatDir { dirs "WebContent/WEB-INF/lib" }
mavenCentral()
}
dependencies {
compile group: 'com.orientechnologies', name: 'orient-commons', version: '1.3.0'
compile group: 'com.orientechnologies', name: 'orientdb-client', version: '1.3.0'
compile group: 'com.orientechnologies', name: 'orientdb-core', version: '1.3.0'
compile group: 'com.orientechnologies', name: 'orientdb-graphdb', version: '1.3.0'
compile group: 'com.orientechnologies', name: 'orientdb-enterprise', version: '1.3.0'
compile group: 'com.tinkerpop.blueprints', name: 'blueprints-core', version: '2.3.0'
compile group: 'com.tinkerpop.blueprints', name: 'blueprints-orient-graph', version: '2.3.0'
compile group: 'com.tinkerpop', name: 'pipes', version: '2.3.0'
compile group: 'com.tinkerpop.gremlin', name: 'gremlin-java', version: '2.3.0'
compile group: 'com.tinkerpop.gremlin', name: 'gremlin-groovy', version: '2.3.0'
testCompile group: 'junit', name: 'junit', version: '4.+'
testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5'
}
sourceSets {
main {
java {
srcDir 'src'
}
}
test {
java {
srcDir 'test'
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '1.3'
}
war {
from 'WebContent'
}
Errors occur, when I launch Gradle Task - Build:
OrientDBFilter.java:6: error: package javax.servlet does not exist
import javax.servlet.FilterChain;
OrientDBFilter.java:5: error: package javax.servlet does not exist
import javax.servlet.Filter;
....
Usually you would use providedCompile. Something like:
providedCompile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.0.1'
Then your app will compile, but gradle won't include the servlet api in the final war file.
I had the same problem and the solution with providedCompile did not work, but simply
compile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.0.1' did work.
I just wanted to share this if somebody has the same problem.
I had same problem and this line worked
compileOnly group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1'