Various technical articles, IT-related tutorials, software information, and development journals
Saturday, October 27, 2018
Gradle tasks as before-launch tasks won't stop TestNG if they fail
An Android Studio project I'm involved in uses a TestNG run configuration to run some tests. To make sure the tests operate on the newest version of the code, the run configuration has Gradle run a "build" task first to compile just the one module we test. We've noticed that even if the Gradle-induced build fails, the test suite goes ahead trying to test whatever compiled artifacts are around and Android Studio switches to the Test tab in the output pane, making it difficult to see that something strange is going on. I have not found a way around this that only compiles a specific module, but if that wasn't a concern, using a Build before-launch task would be fine.
Wednesday, October 24, 2018
If the checkstyle Gradle task fails, reinstall the checkstyle plugin
Some students have been encountering strange Gradle build failures in Android Studio that mention various checkstyle-related failures. Some of these are caused by clearly fixable things like severe syntax errors that prevent checkstyle from parsing the file, but others are more puzzling. One solution that's worked for some students is to uninstall the checkstyle plugin in File | Settings and reinstall it. I personally don't even have the plugin installed and the checkstyle Gradle task works fine.
Sunday, October 21, 2018
TestNG "cannot find class in classpath" can mean the tests didn't compile
I've recently been trying to help students troubleshoot issues with running TestNG tests in Android Studio. A common error is "cannot find class in classpath", referring to the class containing the tests. This often indicates that there's a problem causing the compilation of the test suite to fail. More specific error messages might be visible on the [build] tab of the lower pane where the test results appear.
Thursday, October 18, 2018
Allowing the build to complete even with checkstyle errors
The checkstyle plugin for IntelliJ and Android Studio can trigger a build failure if style violations are detected. This appears to be the default behavior for some versions of the tool. The build can be allowed to proceed anyway by changing the severity setting to "warning" instead of "error." Add this line inside the <module name="Checker"> element:
<property name="severity" value="warning" />
<property name="severity" value="warning" />
Monday, October 15, 2018
IML files from Gradle projects don't need to be in version control
IntelliJ and Android Studio projects include .iml files that seem to represent the project or module. However, that doesn't mean they need to be checked into version control repositories - Gradle projects can automatically generate them when the repository is first imported onto each computer. This JetBrains support article lists all the IDE metadata files that should or should not be in version control.
Friday, October 12, 2018
If IntelliJ mysteriously can't find a package, force a Gradle resync
I'm a course developer for an introductory CS class that uses Java in IntelliJ with the Gradle build system. A semi-common problem students encounter is that the IDE sometimes decides that it can't find the test framework package, so the test suite can't be run. Invalidating IDE caches with Invalidate Caches / Restart doesn't always work. What I have found that works is...
- Open the build.gradle file
- Type some nonsense into it so that the "sync now" notification appears
- Press "sync now" - this should fail due to the nonsense
- Delete the nonsense
- Try the sync again - this should refresh everything
Thursday, October 4, 2018
Tharify package for Keen 3
The PCKF community is continuing its relatively new tradition of minimalistic community level packs. Levels are very constrained in what tiles they may use, making design/gameplay the focus as opposed to aesthetics. The first time this kind of pack was done, some people had technical issues with the usual Vorticons editors, so I whipped up a development environment based on Abiathar and Tharify. Abiathar is an unusual choice for this application because it's a Galaxy editor - I only suggested it as a last resort if no Vorticons editor would run - but apparently it worked well for people, and they requested a Keen 3 setup for this pack. So yesterday I put it together. It was a fairly simple matter of tweaking the Tharify-invoking batch file to work on Keen 3 and once again placing all allowed tiles in the level for people's convenience.
Subscribe to:
Posts (Atom)