When running a Cucumber test, using cucumber.api.cli.Main, the test is failing to recognise the certificates that are installed in the JDK.
I am running using the following:
IntelliJ 2016.1.2 (Build #IU-145.972)
JRE 1.8.0_74-b02
Plugin Cucumber for Java version: 999.999
It works, when run from the following gradle task, from the command line:
task functional(dependsOn: ['testClasses']) << {
javaexec {
main = "cucumber.api.cli.Main"
classpath = sourceSets.test.runtimeClasspath
args = ['--tags', '~#wip',
'--plugin', 'junit:build/junit-test-report.xml',
'--plugin', 'pretty',
'--plugin', 'html:build/cucumber-html-report',
'--plugin', 'json:build/cucumber-json-report.json',
'--glue', 'step_definitions',
'--strict',
'src/test/resources'
]
if(project.hasProperty("coverage")) {
jvmArgs = ["-javaagent:${configurations.codeCoverage.asPath}=destfile=${buildDir}/jacoco/jacoco.exec,sessionid=HSServ,append=false"]
}
}
}
But when I create a Run Configuration for Cucumber, using:
Main Class: cucumber.api.cli.Main
Glue: step_definitions
Feature or Folder path: /Users/xetius/application/src/test/resources/system_tasks/request/validation_handling/request/validate_hardware_fulfilment_request.feature
Program Arguments: --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter --monochrome --name "^Pending details$"
Working Directory: /Users/xetius/application
It fails to recognise the certificates for connecting to the remote services.
I have configured IntelliJ to boot using the external JDK, into which I have installed the certificates using keytool, and I can see that it is using this JDK when running the configuration. I have also tried configuring Server Certificates, and importing the same certificate.
However, within IntelliJ, it throws an exception when connecting to remote services. It is also throwing the exception when gradle is run from within the IntelliJ terminal.
Related
I have a jhipster project that runs just fine when started by the command line "./gradlew" (Ubuntu 20.04.3) but when I start the debbug from the IntelliJ (community) it returns the follow message:
What went wrong:
Execution failed for task ':npmInstall'.
A problem occurred starting process 'command 'npm''
And I need to run it on IntelliJ to use breakpoints and debug.
What I have tried:
I have checked the java version on the IntelliJ compiller
I have the PATH's set correct (I can run other projects)
After trying to redefine things, deleting the "node-modules" folder, 'invalidating and restart' on intelliJ and even checking-out the entire project from git, what did the trick was to change the block on build.gradle, from:
if (project.hasProperty("nodeInstall")) {
node {
version = "14.16.0"
npmVersion = "7.8.0"
download = true
}
}
to
node {
version = "14.16.0"
npmVersion = "7.8.0"
download = true
}
That fixed the problem and now I can debbug using intelliJ
What I am trying to accomplish:
I want the tomcat 9 server to execute an automatic redeploy when I run a Gradle task that updates my HTML files.
This is my setup:
I use IntelliJ 2020.03 (ultimate edition), tomcat 9, the application is a GWT application.
My Configuration for Tomcat:
This is what I see when I hit the "Configure ..." button next to the line labeled "Application server:"
This is my Gradle task I run but tomcat does not automatically redeploy the changes
Things I already tried:
According to [https://www.jetbrains.com/help/idea/updating-applications-on-application-servers.html] I should have an option to "Update resources". But my options are limited to:
Therefore I assume I need to have "Exploded artifacts in local application server run configurations".
Therefore I headed to Tomcat -> Edit Configuration
I replaced the deploy to the exploded artifact:
Using this I get the following error message on starting up tomcat:
[2021-02-12 08:46:05,533] Artifact Gradle : NewComApp.war (exploded): com.intellij.javaee.oss.admin.jmx.JmxAdminException: com.intellij.execution.ExecutionException: C:\Users\heckner\IdeaProjects\NewComApp\build\libs\exploded\NewComApp.war not found for the web module.
So I decided to compare the artifact that "works" (but does not update the HTML files) with the "exploded" artifact which would be probably the right one but throws an error message on startup of tomcat.
This is the one which works ("NewComWar.war"):
This is the one which does throw an error message on startup ("NewComApp.war (exploded)":
As you can see in the image under "... which works". the war already seems to be "exploded". So why does IntelliJ does not offer the "update resources"?
But never the less, when I switch in Tomcat Edition to "NewCompApp.war (exploded)" i am able to select "update resources" in the drop down:
So probably this would be the way to go.
It obviously boils down to the point: What is wrong with the artifact declaration above so that tomcat throws the error message?
The feedback was: "ctually "NewComWar.war" is an archive that contains exploded artifact, that's why only "Redeploy" is possible. Please check that exploded artifact is created in "Output directory". "
Now the question is how I can add the exploded war to the Output Directory?
I tried:
but then I can only select from:
When I add this, it looks like this:
When I run Tomcat, it still says:
[2021-02-12 12:24:54,224] Artifact Gradle : NewComApp.war (exploded): com.intellij.javaee.oss.admin.jmx.JmxAdminException: com.intellij.execution.ExecutionException: C:\Users\heckner\IdeaProjects\NewComApp\build\libs\exploded\NewComApp.war not found for the web module.
Now I found the following tip (thanks Evgeny):
https://youtrack.jetbrains.com/issue/IDEA-178450#focus=streamItem-27-4068591.0-0
I switched under Settings -> Build, Execution, Deployment -> Build Tools -> Gradle: "Build and Run:" IntelliJ IDEA
I added this snipped to build.gradle:
task explodedWar(type: Copy) {
into "$buildDir/libs/exploded/${war.archiveFileName.get()}"
with war
}
war.dependsOn explodedWar
I switched the artifact which is deployed to the tomcat to
this automatically added the Gradle task:
Build 'Gradle:NewComApp.war (exploded) artifact to the
which is defined like this:
This accomplishes two things:
I can choose "Update resources" on my Edit Configuration for Tomcat like shown below:
My deployment runs well under tomcat
But ... :-)
Updates to the HTML files (within the war file) are not exploded to the NewComWar.war directory.
When I start tomcat I see the following file structure under C:\users<myname>\IdeaProjects\NewComApp\Libs\
The reason for this is that we use a Gradle task that generates the HTML files.
This task is called "copyHTML"
Under build.gradle it is defined now as follows:
war {
from 'war'
dependsOn copyHtml
exclude excludeInWar
doFirst {
manifest {
def version = ant.hasProperty('gitversion') ? ant.gitversion : 'undefined version'
println "Version: ${version}"
attributes("Implementation-Title": project.name, "Implementation-Version": version, "Built-By": new Date())
}
}
}
task explodedWar(type: Copy) {
into "$buildDir/libs/exploded/${war.archiveFileName.get()}"
with war
}
war.dependsOn explodedWar
copyHtml {
dependsOn generatorClasses
inputs.dir 'html'
inputs.dir 'email'
inputs.dir 'email.Tags'
inputs.dir props.getProperty('generator.htmlfiles.prefix') + 'html'
inputs.dir props.getProperty('generator.htmlfiles.prefix') + 'html.MeetingApp'
inputs.dir props.getProperty('generator.htmlfiles.prefix') + 'staticHtml'
inputs.properties props
outputs.dirs 'war', 'resources/com/newcomapp/server/mail'
doFirst {
ant.properties["generator.classpath"] = sourceSets.generator.runtimeClasspath.getAsPath()
}
}
task warWithoutGwt(type: War, dependsOn: war) {
}
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(warWithoutGwt)) {
compileGwt.enabled = false
}
}
When I run the Gradle task "warWithoutGWT" while tomcat still runs it says:
C:\Users<myname>\IdeaProjects\NewComApp\build\libs\exploded\NewComApp.war\WEB-INF\classes\com\newcomapp\server\integration\GeoLite2-Country.mmdb (The operation is not applicable to a file with an open area assigned to a user)
I assume that tomcat still holds a reference to that file, and the Gradle task tries to overwrite it (although there was no change to that file). Furthermore, I assume that this kills the rest of the Gradle task so that it does not update the HTML files (it's only an assumption though). How can I arrange an exploded war so that write-protected files are omitted and do not kill the rest of the Gradle task execution?
My answer up to now for this problem is: I changed the gradle script:
task explodedWar(type: Copy) {
into "$buildDir/libs/exploded/${war.archiveFileName.get()}"
exclude "**/*.mmdb"
with war
}
war.dependsOn explodedWar
so I added an "exclude for mmdb files". And this really works.
Is this a correct and good solution or do I overlook something? The reason I am asking is that changing HTML files in the scope of tomcat should be something very common with tomcat based projects. So I wonder if there is a more standardized, easier solution to this? It seems quite clumsy to copy and explode with additional gradle tasks the war file instead of IDEA take care of this.
I upgraded the JVM on my system from JDK 8 to JDK 11 & configured my IntelliJ IDEA (2019.1) to use it.
I am able to compile fine, but can no longer run JUnit5 tests from within the IDE.
I created a basic JUnit test:
#ExtendWith(SpringExtension.class)
class UtilsTest {
#BeforeEach
void setUp() {}
#Test
void testA {}
}
When I run this test with IntelliJ pointing to my JDK 8 install, it runs fine.
If I run this test with IntelliJ pointing to my JDK 11 install, the test fails to run & I get this error:
Unrecognized VM option 'UseSplitVerifier'
Any suggestions on how to fix this problem?
Intellij passes maven-surefire-plugin and maven-failsafe-plugin parameters to your Junit.
I got this trouble too. Even if i uncheck boxes in "Intellij -> File -> Settings -> Running Tests", doesn't work.
I removed the .idea folder and all .iml files and reimported the whole project and now, it's working.
I'm trying to configure Run/Debug configurations in IntelliJ (v2017.2.5) to run cucumber tests written in Groovy (v2.4) using Geb (v1.1.1) in a Gradle project. I need to use InternetExplorerDriver (v3.6)
I tried:
- Installing Cucumber for Groovy plugin and did following in Edit Configurations for IntelliJ:
Main Class: cucumber.api.cli.Main
Glue: C:\automation\Project\src\cucumber\resources\steps C:\automation\Project\src\cucumber\resources\env
Feature or folder path: C:/automation/Project/src/cucumber/features
Program Arguments: --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter --monochrome
I'm getting following error when I run/debug a feature file:
geb.driver.DriverCreationException: failed to create driver from callback 'script15077602688031015554790$_run_closure2#55d58825'
I have tried looking for solutions for similar problem on stackoverflow which suggested upgrading selenium/groovy versions (i'm using latest version
groovyVersion = '2.4'
gebVersion = '1.1.1'
seleniumVersion = '3.6.0'
I'm new to Groovy, Geb and Gradle (I know Java and Maven) hence I suspect it could be a configuration issue.
FYI, the tests run fine through commandline. I need to get debugging in intellij working.
Figured out the answer:
In my case the configuration in IntelliJ was wrong:
I used:
Main Class: cucumber.api.cli.Main
Glue: C:\automation\Project\src\cucumber\resources\steps
C:\automation\Project\src\cucumber\resources\env
Feature or folder path: C:/automation/Project/src/cucumber/features
Program Arguments: --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter --monochrome
module: Project_cucumber
Before launch: Build, Gradle task, Activate tool window:
Run Gradle task 'Project: compileCucumberGroovy'
Activate tool window [checked]
For my Android project I want to run a test HTTP server for my integration tests. I've created a Configuration and have written a task to run my Groovy script the sets up the HTTP server
configurations {
stubs {
description = "Classpath for HTTP server for stubbed data"
visible = false
}
}
dependencies {
compile "com.android.support:support-v13:+"
stubs "org.codehaus.groovy:groovy:2.3.4"
stubs "com.github.tomakehurst:wiremock:1.46"
}
When I edit the Groovy script IntelliJ tells me that the Groovy SDK hasn't been configured.
How can I have IntelliJ use the Groovy SDK that is part of the stubs Configuration? I can't create a Groovy SDK configuration using the Gradle fetched libraries as IntelliJ tells me that the Groovy distribution is broken because the version number can't be determined.
Am I forced to have to download the distribution manually?
The solution was to separate out the project for the HTTP server into a separate project and use Gradle's multiproject's ability to set up the Android tests to depend on the HTTP server being started. Because the separate project is a Groovy project, IntelliJ reads the Groovy version to use from the project's dependencies and all is well.
dependencies {
compile "com.android.support:support-v13:+"
stubs project(":integration-server")
}
/*
* The android plugin defers creation of tasks in such a way that they can't be accessed eagerly as usual
* #see http://stackoverflow.com/questions/16853130/run-task-before-compilation-using-android-gradle-plugin
*/
gradle.projectsEvaluated {
connectedAndroidTest.dependsOn(":integration-server:startBackgroundServer")
// Note: finalizedBy is still #Incubating
connectedAndroidTest.finalizedBy(":integration-server:stopBackgroundServer")
}
integration-server/build.gradle
apply plugin: "groovy"
apply plugin: "spawn"
dependencies {
compile "org.codehaus.groovy:groovy:2.3.4"
compile "org.codehaus.groovy:groovy-ant:2.3.4"
compile "com.github.tomakehurst:wiremock:1.46"
}
task startBackgroundServer(type: SpawnProcessTask, dependsOn: "build") {
def cp = sourceSets.main.runtimeClasspath.asPath
command "java -cp $cp server"
ready "Started DelayableSocketConnector#0.0.0.0:8089"
}
task stopBackgroundServer(type: KillProcessTask)
To prevent the Gradle build blocking I'm using a Gradle Spawn Plugin to launch the HTTP server in the background.