getting started in struts in eclipse,i use maven struts2-archetype-blank.when i run mvn test,there're bugs as following:
testHelloWorld(cn.jx.hw.learn.example.HelloWorldTest) Time elapsed: 0.135 sec <<< ERROR!
java.lang.NullPointerException
at com.opensymphony.xwork2.ActionSupport.getLocale(ActionSupport.java:68)
at com.opensymphony.xwork2.TextProviderSupport.getLocale(TextProviderSupport.java:329)
at com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:204)
at com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:119)
at com.opensymphony.xwork2.ActionSupport.getText(ActionSupport.java:86)
at cn.jx.hw.learn.example.HelloWorld.execute(HelloWorld.java:30)
after comparing HelloworldTest.java with struts-example in github,i change
HelloWorld hello_world = new HelloWorld();
into
container.inject(HelloWorld.class);
and things go right. mvn test don't post bug
Related
I've got a custom Ant task that I'm using successfully from gradle on my local machine:
task fetchRelMod {
doLast {
println 'Fetching the RelMod'
ant.taskdef(name:'relmod',
classpath:'retrievePBSInfo.jar:hsjt400-4-9.jar',
classname:"com.myco.ant.tasks.RetrievePBSRelModString")
ant.relmod(user:project.ext.props.getProperty('fetchrelmod.username'),
password:project.ext.props.getProperty('fetchrelmod.password'),
prodCode:project.ext.props.getProperty('profile.pbs.product.code'),
branch:project.ext.props.getProperty('profile.pbs.branch'),
state:project.ext.props.getProperty('profile.pbs.relmod.selector'))
project.ext.set('iseries_relmod',ant.relmodStub)
project.ext.set('iseries_relmodAndDate', ant.relmod)
}
}
I've got the jar files sitting next to build.gradle for now, out of simplicity... they exist in the same location on the build server. Works great locally. When I run my build from my build server (either through Jenkins or going on the box and running Gradle directly), I get the following:
sudo /var/lib/jenkins/tools/hudson.plugins.gradle.GradleInstallation/gradle214/bin/gradle all -DisQUABuild=true
Building My App
Loading Properties files...
QUA Build. Using build-qua.props
:fetchRelMod
Fetching the RelMod
:fetchRelMod FAILED
FAILURE: Build failed with an exception.
* Where:
Build file '/var/lib/jenkins/workspace/MyApp/build.gradle' line: 141
* What went wrong:
Execution failed for task ':fetchRelMod'.
> taskdef class com.myco.ant.tasks.RetrievePBSRelModString cannot be found
using the classloader AntClassLoader[/var/lib/jenkins/workspace/myApp/hsjt400-4-9.jar]
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 3.104 secs
What concerns me is that there are two jar files in the classpath and it only mentions one in the error. Does anyone have any ideas as to what might be going on?
I have a grails 3 application for which I am trying to pass command line arguments to my application when I am running it through gradle bootRun task.
I want to read the arguments in my config file for runtime operations. As per the grails documentation for yml configration here I tried to add the following to my build.gradle file
run {
systemProperties = System.properties
}
When I add that configuration and run my task I get the following error:
3:11:20 PM: Executing external task 'bootRun -Dcolor=red -Dfruit=apple'...
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\docs\projects\jet\build.gradle' line: 85
* What went wrong:
A problem occurred evaluating root project 'jet'.
> Could not find method run() for arguments [build_6lnm3xriwcnri1zrvfit1niuu$_run_closure8#4446881a] on root project 'jet'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 8.892 secs
Could not find method run() for arguments [build_6lnm3xriwcnri1zrvfit1niuu$_run_closure8#4446881a] on root project 'jet'.
3:11:32 PM: External task execution finished 'bootRun -Dcolor=red -Dfruit=apple'.
Please let me know if there is anything I am missing here or if there is a better way of doing this.
So I find out what the issue was.
Grails 3.0 uses bootRun as target instead of run. Changing adding the below code fixed the issue.
bootRun {
systemProperties = System.properties
}
Hope this helps everyone.
I have Hudson configured for building a project.
And the console output, after building is, as follows:
Compiling ./main.py ...
Sorry: IndentationError: ('expected an indented block', ('./main.py', 8, 6, 'thread.start_new_thread( foo.FooThread, () )\n'))
Compiling ./udpReceiver.py ...
<<<<< build finished!
POST BUILD TASK : SUCCESS
END OF POST BUILD TASK : 0
Deleting project workspace...
done
Finished: SUCCESS
As you can see, I have an Indentation Error....and Hudson says that the build job finished with success.
What I want is something like this:
Check if the string "IndentationError" is presented on the console output text ... if so, than the build should be:
Finished: FAILED!!!!!!!!
How can I accomplish this?
I confirm that the Log Parser plugin can do the job to change the build status to failure.
Install the plugin and create a rule set for your Python build for example:
In the create the /var/lib/jenkins/logParserRules/python-error file:
error /IndentationError/
Next, update the Python build with these settings:
The build status will be changed to FAILURE:
Compiling ./udpReceiver.py ...'
Sorry: IndentationError: ('expected an indented block', ('./main.py', 8, 6, 'thread.start_new_thread( foo.FooThread, () )\n'))
Compiling ./udpReceiver.py ...
Build step 'Console output (build log) parsing' changed build result to FAILURE
I am trying to integrate SonarQube to generate report on my iOS project,
I am using Objective-C Sonar plugin
When i run ./run-sonar.sh
OCLint generates a compile_commands.json file in my root directory.
and after that getting following error
11:24:39.782 INFO - Processing OCLint report /Users/.......app/./sonar-reports/oclint.xml
11:24:39.899 ERROR - Reporting 1073 violations.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 16.240s
Final Memory: 6M/86M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: The rule 'OCLint:ivar assignment outside accessors or init' does not exist.
Can any one help me on this issue?
Thanks
AMR
Thnaks
I had a similar error. My sonar server had two objective-c code analyser plugin. The Sonar Plugin for Objective C (free) and SonarSource Objective-C plugin (commercial)
When I removed (uninstalled) one of the plugin from sonar server the error stopped to occur
I had a similar error too with the last version of this plugin which is a fork of the one you used.
I downgrade my OCLint version from 0.11 to 0.10.1 and everything work perfectly.
It seems that the OCLint rules defined in the plugin was different of the OCLint version installed on my server.
I am not sure what version of the objective-c-sonar plugin that you were using.
I solved similar issue before.
Goto ${SONAR_INSTALLATION_FOLDER}/extensions/plugins/, copy the sonar-objective-c-plugin-${version}.jar to somewhere else.
unzip the jar file, and edit below file
org/sonar/plugins/objectivec/profile-oclint.xml
Add the rule you are missing following the layout of the xml file,
may be look similar below
<rule>
<repositoryKey>OCLint</repositoryKey>
<key>ivar assignment outside accessors or init</key>
</rule>
And edit another file org/sonar/plugins/objectivec/rules-oclint.xml
<rule>
<key>ivar assignment outside accessors or init</key>
<name>ivar assignment outside accessors or init</name>
<priority>MAJOR</priority>
<description>ivar assignment outside accessors or init</description>
</rule>
And then using zip to package the files unpacked as the new jar file.
Override the original plugin jar file in ${SONAR_INSTALLATION_FOLDER}/extensions/plugins/, restart the sonar, issue could be gone.
Repeat the step for all similar issues you encountered.
We're currently using JUnit 4.4 and Ant 1.7.1 for our builds. I have some test cases that are #Ignored. When I run them in Eclipse, the JUnit test runner reports them as ignored. I would like to see them listed in the XML output from Ant (so I can report on them), but they do not seem to be there.
Does anyone have this working? Is there a switch to turn them on? An upgrade I need to do?
It looks like this is a known Ant issue/bug.
This thread talks about the same issue, but it provides some additional information: you can get data on ignored tests when running the tests using maven surefire, and hudson is able to display that data.
http://jenkins.361315.n4.nabble.com/Is-it-possible-to-show-Ignore-JUnit-tests-td1565288.html
A fix for this issue has now been applied to the head of Ant core, scheduled for release as part of the upcoming version of Ant 1.9.0.
It should be possible to try this fix locally be replacing ant-junit.jar in your Ant distribution's lib directory with the version from the nightly builds, or by running the full nightly Ant distribution, or by building the Ant sources directly. Since the Ant team are currently voting on preparing a new release it may just be worth waiting for 1.9.0 to be officially packaged and pushed out for download.
Just tried Ant 1.9.0 with JUnit 4.11. If you use <junit printsummary="on"> you'll get output like:
[junit] Running com.example.IgnoredTest
[junit] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.01
[junit] Running com.example.PassingTest
[junit] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01
[junit] Running com.example.FailingTest
[junit] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.01
I think it'd be preferrable if we could get output like this with printsummary=off:
[junit] Test com.example.IgnoredTest SKIPPED
[junit] Test com.example.FailingTest FAILED
but it seems the more verbose output above is the best we can do, unless I'm missing some obscure trick with one of the junit task arguments.