intelliJ debug not finding file in target folder - maven

Hello I have an appengine module that won't work properly since I change my old appengine plugin to the new google cloud tools.
I have a module that is a child of my project.
I have a maven directive to copy some files from another child modules to the target folder of my module target/artifcat-name/WEB-INF.
The copy works.
But when I debug the appengine module in Intellij, I have a FileNotFoundException while trying to read the copied file from the target dir.
It worked fine before the update.
It also works fine when I run the devserver from the shell (mvn appengine:devserver.
I don't what I should change in Intellij to have it working again.
Ideas?
Thanks.

Related

Customize working directory run gradle run task / project structure for web application

I'm working on small web app and I want to serve static files. I'm using application plugin. Part of it is distribution plugin which copies src/main/dist files into distribution zip. Running application with gradlew run uses project dir as working directory. For this reason static files are not found.
Is there a simple way to change working directory for run task?
Is there any other recommended structure for web app gradle project setup?
I have had a similar case when running './gradlew run' of a Kotlin (console) app. The default working directory is the application directory, but IntelliJ uses the root project directory by default.
I have managed to change the working directory by setting the workingDir property of the run task. The list of properties can be found on https://docs.gradle.org/current/dsl/org.gradle.api.tasks.Exec.html
application {
mainClass.set("myproject.HelloKt")
// Change the working directory for the run task. Here is an example:
tasks.run.get().workingDir = rootProject.projectDir
}
You need to add the following to your build.gradle file to modify the working directory of a gradle task.
File runningDir = new File('build/run/')
runningDir.mkdirs()
tasks.run.workingDir = runningDir
Check this thread for reference.

Error: Can not find or load the main class com.example.demo.DemoApplication

i use spring STS meven and tomcat eclipse
all that is installed succesfuly
i imported the project from spring-initialiser
but i can't run my project
any help
Assuming you have not changed any codes and using exact code from spring initializer, it should work fine.
Make sure .class file is generated and it's in build path.
If above is ok then clean your workspace.
Go to your workspace, delete .metadata directory (or to be safe, copy the directory somewhere else to be safe)

Titanium Android module fails with "does not have a main jar file"

I've created my own new Android Titanium module. The module build was successful and I have the artefact in the dist directory.
I've dropped the zip file inside my project, setup tiapp.xml, cleaned the project, but when running on the device I'm getting the red screen saying
Uncaught Error: Requested module not found: com.myproject.mymodule
I even tried extracting the zip manually and not let Studio do it. I cleaned the project several times.
Why wouldn't it find my module?
EDIT
I now notice a WARN message while compiling the app:
Module com.myproject.mymodule version 1.0.0 does not have a main jar file
I'm doing an ant build from eclipse and everything seems fine. I see the jar file created and present in the module directory inside my project.
Was facing the same error right now and I had a look at the place the error messages appears. It's searching for module.manifest.name.toLowerCase() + '.jar'. So have a look at the modules/android/com.myproject.mymodule/1.0/ folder: the jar file should have the name that is inside the mainifest file (name tag)
The the warning should disappear and the module should be loaded correctly.
You can try doing packaging the module in SDK location or in the particular project and see if things work. What I have always done is packaging the module in SDK location and add it in tiapp.xml of the project I want to use the module without facing any error like this.

problems running state machine examples

Congratulations on the spring state machine, I found it yesterday and have been trying it out, specifically the turnstile example running in STS. I found it very easy and intuitive to build a FSM.
Because spring shell doesn't work well in STS I tracked down the instructions to run the examples from the command line in the reference doc,
"java -jar
spring-statemachine-samples-turnstile-1.0.0.BUILD-SNAPSHOT.jar"
,
but running it got an error
"no main manifest attribute, in spring-statemachine-samples-turnstile-1.0.0.BUILD-SNAPSHOT.jar".
Although not even a novice in using gradle, I tried fixing this by adding this line to build.gradle in the jar section
"manifest.attributes['Main-Class'] = 'demo.turnstile.Application'"
(which doesn't handle the various sub-projects I know) but got this error
"NoClassDefFoundError: org/springframework/shell/Bootstrap".
If it is possible to run the samples from gradle, could you include them in the reference document? I tried running the samples using
gradle run
but it there was no interaction with the shell scripts.
Samples are designed to be run as executable jar and with shell so that you can interact without a need to recompile with every change. Your error indicates that you didn't build that sample jar as mentioned in docs.
./gradlew clean build -x test
This will automatically use spring boot plugin which will add the necessary jar manifest headers to jar meta info to make it a true executable jar. Essentially every every sample is a spring boot app.
Building SM sample projects in Windows Environment:
Open Command prompt (windows key + r -->cmd-->Enter), Change directory to project root folder spring-statemachine-master (Inside the Extracted folder).
Run gradlew install to get all spring dependencies copied to local machine.
Run gradlew clean build -x test to get the spring shell jars built. Courtesy Janne
These steps should ideally get all .jar built, look into \build\libs folder of respective sample project for jar files.
Run the like any other java jar file java -jar [jar-file-name.jar] (make sure to be change directory to jar file directory location).
One more thing where I was stuck was, How to give events to SM:
It's like this sm event EVENT_NAME_AS_DEFINED_IN_CLASS. Ref
E.g.: sm event RINSE --> to washer project

jboss-as-maven-plugin: which directory does command "jboss-as:deploy" deploy an .ear to?

I am running jboss 7.1, maven 3, and a java ee6 application that generates an .ear
I am doing a mvn clean package jboss:as-deployand Jboss-as-maven-plugin 1.5 does its thing--I can view my app using http://localhost:8080...
just fine, but I want to know where the actual .ear is being put.
It is not in my jboss7.../standalone/deployments folder. So where is it? My app is obviously running in jboss 7.1 just fine, but I can't find the .ear file. I know that there is an .ear in Eclipse's 'target' directory, but that wasn't produced by jboss-as-maven-plugin is it? I hope you can understand my confusion--don't all .ear files need to be in the deployments directory? I also do see my .ear file inside my hidden .m2/repository directory, but does this have any interaction with jboss-as-maven-plugin? Maybe there is some hidden sym-linking between my Eclipse project's 'target' directory and the jboss7.1 standalone/deployment directory?
p.s. I am used to using a hard-deploy option with the other plugin jboss-maven that requires you to say jboss:hard-deploy which just copies the .ear to your deployments folder. Then jboss would pick up the new .ear and redeploy automatically. I get the sense that jboss-as-maven-plugin is the preferred plugin so that's why I am bothering.
The jboss-as-maven-plugin uses the deployment API so it doesn't copy the file to the deployments directory for the scanner to pick it up. It deploys just as if you deployed it from the web console or via CLI. The files should be located somewhere in the $JBOSS_HOME/standalone/data/ directory.
You're welcome to open an issue, for a discussion around it at least. I'm not sure how I feel about adding a goal for it, but here isn't the place to discuss that :)

Resources