Running mule application in MuleStudio - maven

While running mule application in MuleStudio, I see 2 options.
Run As > Mule Application
Run As > Mule Application with Maven
I always used first option which worked fine, until a point of time when I defined maven filter. Using the first option the filters were not getting resolved, so I tried to run using second option which resulted in the following error --
[12:04:57] Starting build...
Error: Could not find or load main class local
I created a test project for sharing this problem and uploaded it on github https://github.com/hshira/mule-mvn-filter
pom.xml > https://github.com/hshira/mule-mvn-filter/blob/master/pom.xml
Please suggest me, what is the right way to resolve filters in MuleStudio.
FYI ... the filtered property is resolved correctly if I build on terminal using mvn command

it could be issue with maven setup on your local machine.

Related

Maven tests run locally but fail in github action

I'm trying to run the basic maven java action listed here on my repo here: https://github.com/dhowe/rita2/
The mvn -B package --file pom.xml cmd runs correctly in my local repo, but the tests fails in the github action with the following error (full log here):
Exception: Cannot load dictionary at rita_dict.js /home/runner/work/rita2/rita2
So its clear that the dictionary resource is not being found when run via the github action. But why would the file (src/main/java/rita_dict.js) be found by maven locally, but not when run in the action ?
Switched to specifying the resource in /src/main/resources as suggested by P3trur0 (not sure why it wasn't working when specified as a resource in maven) after which builds work as expected

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

Setting an Endpoint in Jenkins

I currently have a SoapUI project which I intend to have executed periodically (every 5 minutes) in Jenkins. I've completed the following thus far:
Created the relevant directory in the Workspace i.e workspace\SOA\SOAProject\src\test\soapui\SoapUIProject.xml
I've configured a pom.xml which sits in the SOAProject folder alongside the src folder
I've created a Jenkins job (I've chosen a Maven project, although it should not be an issue if I had chosen a freestyle job)
My question is, how do I set the endpoint?
I've done the following...
Build
**Root POM** pom.xml
Goals and options
testrunner.bat -e0.00.0.006:8040
Edit:
I've installed the EnvInject plugin. I'm not sure how to create the /properties file and what to put in their in order to set the execution environment?
I don't know the answer, but my suggestion is to get it running via command-line first. Once you figure out how to launch it without Jenkins, having Jenkins issue the same command because easy.
If you choose a Maven project, there is a useful plugin to set the endpoint and different propeties for the testSuites...
https://github.com/redfish4ktc/maven-soapui-extension-plugin

How to avoid unneeded recompilation from IntelliJ Idea 13 when it runs a maven vaadin project created in the command line

I have created a maven vaadin project using the command line like this:
mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=7.1.9
Then I change into the folder of the application and I give at the command line the following :
mvn install
After waiting for the application to compile, I open it using IntelliJ Idea (by opening the pom.xml file), I add Tomcat Server and I press run.
Then the IntelliJ Ide recompiles the application again.
Is there any way I can avoid this second compilation?
Thank you.
You should have tomcat configured as a server, and configure your module(s) to deploy at server startup. On the run configuration you will see a list of things to do before launch. It will probably say Make -- you can remove this if you need to.
However, you probably should allow idea to do this for you and really stop doing it on the command line. Idea can handle more complex build patterns for you. You should trust it.

set configuration properties in sonar

Maybe, this question is silly but I'm very new. I try to search without luck.
I got two errors when building maven project with sonar:
No information about coverage per test.
Although I had test code and these testing classes cover the code.
The global property 'sonar.doxygen.deploymentPath' is not set. Set it in SONAR and run another analysis.
I dont know it should be set where in sonar server. I set in web.xml or sonar-server.properties but it does not work.
Thanks.
About the first warning message this is not an error but a warning : since Sonar 3.5 this is possible to get the code coverage relating to each unit test. Here the message just says that this feature is not activated which is expected by default. Nevertheless I do agree that this warning message can be misleading.
About the second error message, I don't know the doxygen plugin but the message seems to be pretty clear : the sonar.doxygen.deploymentPath property has not be defined. See the plugin documentation : http://docs.codehaus.org/display/SONAR/Doxygen+Plugin.
Two things:
There is no war folder anymore since the sonarqube has given up tomcat support
The doxygen plugin is not implemented to upload the files in to the sonarqube server &/ installation, which means it only can be done by referencing the path inside your installation, e.g.:
run "mvn install sonar:sonar" in your project "/root/test.example.sonar.com"
in sonarqube set the cfg-key "sonar.doxygen.deploymentPath" the value: "/root/sonarqube-4.1.1/web/" and the cfg-key "sonar.doxygen.deploymentUrl" the value: "http://:9000"
have fun with your doxygen
Remember that the plugin will only be run through your mvn cmd, refreshing the page only will not do the job, you will have to analyse again after each cfg set :/
Check the file system and folder permission

Resources