Gradlew checkstyleMain command not using right directory - gradle

I'm trying to run ./gradlew checkstyleMain on my project, and I keep getting this error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':checkstyleMain'.
> Unable to create Root Module
when I run it with --stacktrace, I get
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module SuppressionFilter - Unable to find: .checks/checkstyle_suppressions.xml
at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:477)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:198)
at com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask.createRootModule(CheckstyleAntTask.java:412)
... 140 more
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable to find: .checks/checkstyle_suppressions.xml
at com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader.getSuppressionLoader(SuppressionsLoader.java:279)
at com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader.loadSuppressions(SuppressionsLoader.java:233)
at com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader.loadSuppressions(SuppressionsLoader.java:220)
at com.puppycrawl.tools.checkstyle.filters.SuppressionFilter.finishLocalSetup(SuppressionFilter.java:81)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:194)
at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:472)
... 142 more
Caused by: java.io.FileNotFoundException: /Users/Matthew.Hall/.gradle/daemon/7.4.2/.checks/checkstyle_suppressions.xml (No such file or directory)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:653)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:150)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:861)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637)
at com.puppycrawl.tools.checkstyle.XmlLoader.parseInputSource(XmlLoader.java:84)
at com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader.getSuppressionLoader(SuppressionsLoader.java:275)
... 147 more
I've checked, and the file is in the my in my .checks folder in my project, however that last "caused by" makes it look like its checking a folder it shouldn't be.
I'm able to work around it by copying my .checks folder from the project into /Users/Matthew.Hall/.gradle/daemon/7.4.2/ but I shouldn't have to do that.
How can I fix this? (Can't figure out how to get it to check in my project folder instead of .gradle/daemon/7.4.2).

Related

Jenkins Build Failure, is this a Path variable issue?

I am new to Jenkins and currently doing a course on Udemy, I am working on Windows.
I am trying to build a sample project using the Maven plugin.
I am getting the following error in the console output after the build failure.
ERROR: Failed to parse POMs
java.io.IOException: Cannot run program " C:\Program Files\Java\jdk1.8.0_291/bin/java" (in directory "C:\Users\Shashank\AppData\Local\Jenkins\.jenkins\workspace\Time Tracker"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at hudson.Proc$LocalProc.<init>(Proc.java:252)
at hudson.Proc$LocalProc.<init>(Proc.java:221)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:996)
at hudson.Launcher$ProcStarter.start(Launcher.java:508)
at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:280)
at hudson.maven.ProcessCache.get(ProcessCache.java:236)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:802)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:513)
at hudson.model.Run.execute(Run.java:1906)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:453)
at java.lang.ProcessImpl.start(ProcessImpl.java:140)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 12 more
Finished: FAILURE
I noticed a sudden change from \ to / in here
Cannot run program " C:\Program Files\Java\jdk1.8.0_291/bin/java"
is that the issue ? Any help will be appreciated.
Below is a screenshot of the configuration
It can be due to the space at the beginning of the command.
try "C:\Program Files\Java\jdk1.8.0_291/bin/java" instead of " C:\Program Files\Java\jdk1.8.0_291/bin/java"
even " C:\Windows\explorer.exe" won't work with the preceding space character when it is used with quotation marks...

myeclipse maven build 206 error

Caused by: org.codehaus.mojo.gwt.shell.JavaCommandException: Failed to
execute command line : Caused by:
org.codehaus.plexus.util.cli.CommandLineException: Error while
executing process. Caused by: java.io.IOException: Cannot run program
"D:\Java\jdk1.8.0_60\jre\bin\java": CreateProcess error=206,
文件名或扩展名太长。
The error message says 文件名或扩展名太长。 which translates to "The filename or extension is too long". Check the stack trace. It shows a long command line trying to be executed, but I can't see the whole line. So the problem may be exactly as stated in the error message and you will have to find a way to reduce the length of the command line, perhaps by reducing the length of the classpath parameter.

Create a build job for sample cucumber ruby project

I am trying to create a build job for my cucumber test in mac. However its throwing error. Not sure what i am doing wrong. I can run my tests using this in Terminal:
bundle exec cucumber -t #tests
in Jenkins "Execute Batch commands" section i have added below:
bundle install
bundle exec cucumber -t #tests
I am getting this below errors in my Jenkins Console Output:
Started by user anonymous
Building in workspace /Users/MacPro/.jenkins/workspace/build_job_name
[tests_build] $ cmd /c call /var/folders/fx/m8ltp5dx17lbmqpgpwlc9ps00000gn/T/hudson6634803463309653425.bat
FATAL: command execution failed
java.io.IOException: Cannot run program "cmd" (in directory "/Users/MacPro/.jenkins/workspace/tests_build"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:815)
at hudson.Launcher$ProcStarter.start(Launcher.java:381)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:95)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:64)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
at hudson.model.Build$BuildExecution.build(Build.java:205)
at hudson.model.Build$BuildExecution.doRun(Build.java:162)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1738)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:184)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
... 15 more
Build step 'Execute Windows batch command' marked build as failure
An attempt to send an e-mail to empty list of recipients, ignored.
Finished: FAILURE
Need help to resolve this.

Getting File permissions error when exploding the cucumber-jvm.jar

I am trying to create an executable jar for functional tests by exploding the dependency jars, using gradle task of type Jar.
Cucumber-1.1.3 is one of the dependencies.
I am using gradle 1.1 with JVM 1.6 (company standards)
I get the following error :
org.gradle.api.GradleException: Could not expand ZIP '/dev/shm/263985/transformer/caches/artifacts-14/filestore/info.cukes/cucumber-java/1.1.3/jar/4b389fbe494942b319518d27ae38571f477967f6/cucumber-java-1.1.3.jar'.
at org.gradle.api.internal.file.archive.ZipFileTree.visit(ZipFileTree.java:97)
at org.gradle.api.internal.file.collections.FileTreeAdapter.visit(FileTreeAdapter.java:96)
at org.gradle.api.internal.file.AbstractFileTree$FilteredFileTree.visit(AbstractFileTree.java:136)
at org.gradle.api.internal.file.AbstractFileTree.getFiles(AbstractFileTree.java:37)
at org.gradle.api.internal.file.CompositeFileCollection.getFiles(CompositeFileCollection.java:39)
at org.gradle.api.internal.file.AbstractFileCollection.iterator(AbstractFileCollection.java:60)
at org.gradle.api.internal.changedetection.DefaultFileSnapshotter.snapshot(DefaultFileSnapshotter.java:42)
at org.gradle.api.internal.changedetection.InputFilesChangedUpToDateRule.create(InputFilesChangedUpToDateRule.java:35)
at org.gradle.api.internal.changedetection.CompositeUpToDateRule.create(CompositeUpToDateRule.java:35)
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$HistoricExecution.calcCurrentState(DefaultTaskArtifactStateRepository.java:80)
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$HistoricExecution.isUpToDate(DefaultTaskArtifactStateRepository.java:88)
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.isUpToDate(DefaultTaskArtifactStateRepository.java:128)
at org.gradle.api.internal.changedetection.ShortCircuitTaskArtifactStateRepository$ShortCircuitArtifactState.isUpToDate(ShortCircuitTaskArtifactStateRepository.java:77)
at org.gradle.api.internal.changedetection.FileCacheBroadcastTaskArtifactStateRepository$1.isUpToDate(FileCacheBroadcastTaskArtifactStateRepository.java:37)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:247)
at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:192)
at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:177)
at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:36)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31)
at org.gradle.cache.internal.DefaultCacheAccess$1.create(DefaultCacheAccess.java:111)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:126)
at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:109)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:129)
at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
at org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:155)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:110)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:78)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:38)
at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:39)
at org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:25)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
at org.gradle.launcher.cli.ActionAdapter.execute(ActionAdapter.java:30)
at org.gradle.launcher.cli.ActionAdapter.execute(ActionAdapter.java:22)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:200)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:173)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:138)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:48)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.Main.main(Main.java:39)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
Caused by: org.gradle.api.GradleException: Could not copy zip entry /dev/shm/263985/transformer/caches/artifacts-14/filestore/info.cukes/cucumber-java/1.1.3/jar/4b389fbe494942b319518d27ae38571f477967f6/cucumber-java-1.1.3.jar!cucumber/api/java/ar/??.class to '/dev/shm/263985/transformer/target/tmp/expandedArchives/cucumber-java-1.1.3.jar_6mn6efsv2arssmg9fup79f3fm5/cucumber/api/java/ar/??.class'.
at org.gradle.api.internal.file.AbstractFileTreeElement.copyTo(AbstractFileTreeElement.java:68)
at org.gradle.api.internal.file.archive.ZipFileTree$DetailsImpl.getFile(ZipFileTree.java:124)
at org.gradle.api.internal.file.AbstractFileTree$1.visitFile(AbstractFileTree.java:39)
at org.gradle.api.internal.file.AbstractFileTree$FilteredFileTree$1.visitFile(AbstractFileTree.java:145)
at org.gradle.api.internal.file.archive.ZipFileTree.visit(ZipFileTree.java:90)
... 61 more
Caused by: java.io.IOException: Failed to set file permissions 420 on file ??.class. errno: 84
at org.gradle.internal.nativeplatform.filesystem.LibcChmod.chmod(LibcChmod.java:39)
at org.gradle.internal.nativeplatform.filesystem.GenericFileSystem.chmod(GenericFileSystem.java:67)
at org.gradle.api.internal.file.AbstractFileTreeElement.copyTo(AbstractFileTreeElement.java:65)
... 65 more
Note: This works fine when you use gradle 1.1 with JVM 1.7.
Let me know if you guys know why this is happening and is there any fix or alternatives.
Thanks in advance!!
You may be encountering an issue we've run into. I'm not sure we 100% understand it, but it appears that when unzipping an archive that has read-only files in it gradle can struggle. Gradle attempts to check the zip against any files it has already unzipped in order to know if the unzipping task is up-to-date, and this process can blow up if the archive has read-only files.
Notice lines like this in your stacktrace:
org.gradle.api.internal.changedetection.CompositeUpToDateRule.create
Caused by: java.io.IOException: Failed to set file permissions 420 on file
Not quite a smoking gun, but a pretty strong implication. Our solution (hacky, I'll admit) was to use the following code:
def fixExpandedArchivesForLinux() {
// This interesting hackery fixes the expandedArchives directory
// to avoid the read-only extracted ZIP file contents issue.
def dir = new File(buildDir, "tmp/expandedArchives")
FilePermissions.chmodRecursively(dir, 0200)
}
You can put that in a do first to allow gradle to re-expand the archive while it checks the up-to-date status.
I got a similar issue when working with android libraries (aars). I got it working by deleting the directories where the aars are exploded.
def str = "rm -rf "+buildDir.absolutePath+"/exploded-aar"
str.execute()
I just had the same problem involving a file called "??.class" in cucumber.
The exception cause from a run of
./gradlew connectedCheck --debug --stacktrace
showed the following root cause
Caused by: net.rubygrapefruit.platform.NativeException:
Could not set UNIX mode on .../app/build/tmp/expandedArchives/cucumber-java-1.2.4.jar_bkzp93af0tagkjvsr5vkgywjd/cucumber/api/java/ar/??.class:
could not convert string to current locale
It turns out that I had a problem with my locale for which I had previously ignored all warnings from other command line tools.
I checked which locales are mentioned in /etc/locale.conf, uncommented the corresponding lines in /etc/locale.gen and ran
sudo locale-gen
to regenerate the locales.
After this, the file names showed up like ਅਤੇ.class and the unzipping worked flawlessly.

emma coverage tool

I am getting the following error while trying to get coverage data using emma ctl tool.
EMMA: processing control command sequence ...
EMMA: executing [coverage.get (C:/FD_DEV3/feddebt_sources/report/emma/coverage.ec,true,true)] ...
[EMMA v2.1, build 5320 (stable)]
emma ctl: coverage.get: RPC failure while executing [coverage.get]
Exception in thread "main" com.vladium.emma.EMMARuntimeException: coverage.get: RPC failure while executing [coverage.get]
at com.vladium.emma.ctl.CtlProcessor._run(CtlProcessor.java:242)
at com.vladium.emma.Processor.run(Processor.java:88)
at com.vladium.emma.ctl.ctlCommand.run(ctlCommand.java:151)
at emma.main(emma.java:50)
Caused by: java.io.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:770)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:286)
at com.vladium.emma.rt.rpc.Response.read(Response.java:46)
at com.vladium.emma.rt.RTControllerClientProxy.execute(RTControllerClientProxy.java:100)
at com.vladium.emma.ctl.CtlProcessor._run(CtlProcessor.java:231)
... 3 more
Please help.
Thanks
The reason for it is:
The jar is not correct. Make sure that the jar is correct one.
The other error is that you did not place the jar in java/jre folder .

Resources