When I run cobertura-maven-plugin on Windows 8.1 with lengthy configuration (used to prohibit any coverage drop in the project) cobertura:check
goal fails with error The command line is too long.
The problem is probably connected to Command prompt (Cmd. exe) command-line string limitation, as it disappears when I limit amount of configuration provided to Cobertura. Moreover, it works fine on Linux.
How can I overcome this problem?
Logs on debug level:
[DEBUG] Executing command line:
[DEBUG] cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_25\jre\bin\java" net.sourceforge.cobertura.check.CheckCoverageMain --datafile C:\IdeaProjects\checkstyle\target\cobertura\cobertura.ser --branch 100 --line 100 --totalbranch 82 --totalline 90 --regex .*.checks.UncommentedMainCheck:88:83 --regex .*.checks.indentation.MethodCallLineWrapHandler:0:0 --regex .*.checks.indentation.ImportHandler:87:50 --regex .*.checks.imports.Guard:100:86 --regex .*.checks.sizes.AnonInnerLengthCheck:92:100 --regex .*.checks.DeclarationCollector:100:94 --regex .*.checks.whitespace.ParenPadCheck:95:86 --regex .*.TreeWalker:91:92 --regex .*.checks.naming.AbstractTypeParameterNameCheck:83:75 --regex .*.checks.naming.LocalVariableNameCheck:100:94 --regex .*.api.SeverityLevelCounter:76:50 --regex .*.checks.indentation.ForHandler:95:75 --regex .*.checks.regexp.RegexpMultilineCheck:76:100 --regex com.puppycrawl.tools.checkstyle.Utils:93:85 --regex .*.checks.coding.VariableDeclarationUsageDistanceCheck:97:90 --regex .*.checks.imports.ImportControlLoader:88:72 --regex .*.api.LocalizedMessage:81:66 --regex .*.api.FileContents:94:96 --regex .*.api.AbstractViolationReporter:90:100 --regex .*.checks.imports.CustomImportOrderCheck:91:93 --regex .*.checks.javadoc.AbstractJavadocCheck:93:90 --regex .*.checks.naming.ConstantNameCheck:92:88 --regex .*.checks.javadoc.HtmlTag:90:75 --regex .*.api.ScopeUtils:0:0 --regex .*.checks.modifier.RedundantModifierCheck:96:97 --regex .*.DefaultLogger:76:75 --regex .*.checks.metrics.BooleanExpressionComplexityCheck:80:74 --regex .*.checks.design.OneTopLevelClassCheck:95:77 --regex .*.checks.coding.DefaultComesLastCheck:90:87 --regex .*.checks.sizes.ExecutableStatementCountCheck:95:81 --regex .*.checks.UpperEllCheck:83:100 --regex .*.checks.regexp.CommentSuppressor:100:75 --regex .*.checks.naming.AbstractClassNameCheck:90:100 --regex .*.checks.javadoc.WriteTagCheck:91:100 --regex .*.checks.CheckUtils:97:91 --regex .*.checks.DescendantTokenCheck:96:91 --regex .*.checks.coding.UnnecessaryParenthesesCheck:96:91 --regex .*.checks.blocks.RightCurlyCheck:95:88 --regex .*.checks.coding.IllegalTypeCheck:93:93 --regex .*.checks.TodoCommentCheck:92:100 --regex .*.checks.coding.MultipleVariableDeclarationsCheck:96:96 --regex .*.checks.ClassResolver:93:86 --regex .*.checks.coding.DeclarationOrderCheck:90:82 --regex .*.checks.blocks.LeftCurlyCheck:94:87 --regex .*.checks.coding.AbstractIllegalMethodCheck:92:100 --regex .*.checks.whitespace.EmptyForInitializerPadCheck:93:91 --regex .*.checks.whitespace.WhitespaceAroundCheck:98:96 --regex .*.checks.coding.ParameterAssignmentCheck:91:80 --regex .*.checks.whitespace.NoWhitespaceBeforeCheck:100:90 --regex .*.PropertiesExpander:83:50 --regex .*.checks.indentation.BlockParentHandler:98:86 --regex .*.checks.metrics.AbstractClassCouplingCheck\$.*:100:78 --regex .*.checks.coding.IllegalInstantiationCheck:94:77 --regex .*.checks.coding.SimplifyBooleanExpressionCheck:77:100 --regex .*.checks.RegexpCheck:100:97 --regex .*.checks.coding.ReturnCountCheck:74:55 --regex .*.api.JavadocTagInfo:77:25 --regex .*.checks.coding.AvoidInlineConditionalsCheck:66:100 --regex .*.checks.coding.FinalLocalVariableCheck:100:79 --regex .*.api.AutomaticBean:82:90 --regex .*.checks.coding.InnerAssignmentCheck:97:88 --regex .*.checks.whitespace.EmptyForIteratorPadCheck:92:100 --regex .*.checks.coding.RequireThisCheck:89:100 --regex .*.checks.imports.AvoidStaticImportCheck:95:85 --regex .*.checks.whitespace.TypecastParenPadCheck:88:87 --regex .*.checks.naming.AbstractAccessControlNameCheck:80:95 --regex .*.checks.ArrayTypeStyleCheck:94:100 --regex .*.checks.TranslationCheck:83:81 --regex .*.checks.javadoc.JavadocTypeCheck:91:95 --regex .*.checks.AbstractOptionCheck:80:100 --regex .*.checks.coding.EqualsHashCodeCheck:96:75 --regex .*.checks.naming.MemberNameCheck:85:91 --regex .*.checks.javadoc.JavadocTagContinuationIndentationCheck:86:81 --regex .*.checks.whitespace.EmptyLineSeparatorCheck:98:95 --regex .*.checks.metrics.NPathComplexityCheck:96:100 --regex .*.checks.header.RegexpHeaderCheck:93:87 --regex .*.checks.AvoidEscapedUnicodeCharactersCheck:98:97 --regex .*.checks.javadoc.JavadocMethodCheck:96:90 --regex .*.checks.coding.ModifiedControlVariableCheck:93:83 --regex .*.checks.whitespace.MethodParamPadCheck:95:100 --regex .*.checks.annotation.MissingDeprecatedCheck:96:92 --regex .*.checks.indentation.NewHandler:77:83 --regex .*.checks.javadoc.JavadocUtils:91:83 --regex .*.checks.naming.MethodNameCheck:93:100 --regex .*.checks.indentation.ElseHandler:100:75 --regex .*.checks.naming.AbstractNameCheck:87:100 --regex .*.checks.naming.ParameterNameCheck:80:75 --regex .*.checks.coding.HiddenFieldCheck:97:96 --regex .*.checks.imports.RedundantImportCheck:94:81 --regex .*.api.LocalizedMessage\$.*:66:41 --regex .*.filters.SuppressionCommentFilter:87:83 --regex .*.checks.indentation.IndexHandler:75:100 --regex .*.checks.javadoc.AtclauseOrderCheck:88:88 --regex .*.checks.imports.PkgControl:100:80 --regex .*.PropertyCacheFile:19:22 --regex .*.checks.indentation.MethodCallHandler:87:63 --regex .*.checks.coding.StringLiteralEqualityCheck:87:100 --regex .*.checks.metrics.JavaNCSSCheck:96:81 --regex .*.checks.javadoc.SummaryJavadocCheck:100:93 --regex .*.checks.coding.AbstractIllegalCheck:100:64 --regex .*.checks.whitespace.GenericWhitespaceCheck:96:86 --regex .*.checks.coding.HiddenFieldCheck\$.*:100:94 --regex .*.api.TokenTypes:80:62 --regex .*.PackageObjectFactory:75:75 --regex .*.checks.naming.PackageNameCheck:88:100 --regex .*.checkstyle.AnnotationUtility:60:60 --regex .*.checks.whitespace.OperatorWrapCheck:81:68 --regex .*.api.AuditEvent:93:100 --regex .*.checks.indentation.LineSet:90:100 --regex .*.checks.AbstractTypeAwareCheck\$.*:80:50 --regex .*.api.Check:86:100 --regex .*.checks.naming.StaticVariableNameCheck:87:81 --regex .*.checks.indentation.ExpressionHandler:97:91 --regex .*.checks.regexp.MultilineDetector:87:58 --regex .*.checks.regexp.DetectorOptions:96:100 --regex .*.checks.coding.FallThroughCheck:95:90 --regex .*.checks.OuterTypeFilenameCheck:92:71 --regex .*.checks.AbstractTypeAwareCheck:84:87 --regex .*.api.AbstractFileSetCheck:87:75 --regex .*.checks.indentation.SlistHandler:94:100 --regex .*.checks.whitespace.AbstractParenPadCheck:100:88 --regex .*.checks.sizes.MethodCountCheck:23:31 --regex .*.api.JavadocTagInfo\$.*:8:0 --regex .*.checks.TrailingCommentCheck:93:90 --regex .*.checks.coding.MissingSwitchDefaultCheck:87:100 --regex .*.checks.coding.IllegalTokenCheck:100:75 --regex .*.checks.indentation.PrimordialHandler:60:100 --regex .*.checks.coding.MissingCtorCheck:92:75 --regex .*.checks.indentation.HandlerFactory:81:77 --regex .*.checks.annotation.MissingOverrideCheck:96:100 --regex .*.checks.indentation.PackageDefHandler:85:50 --regex .*.checks.UniquePropertiesCheck\$.*:90:75 --regex .*.api.FullIdent:96:83 --regex .*.checks.annotation.PackageAnnotationCheck:77:50 --regex .*.checks.blocks.EmptyBlockCheck:100:88 --regex .*.checks.metrics.AbstractClassCouplingCheck:97:87 --regex .*.checks.coding.SimplifyBooleanReturnCheck:96:83 --regex .*.checks.metrics.ClassFanOutComplexityCheck:80:100 --regex .*.checks.coding.NestedTryDepthCheck:81:50 --regex .*.checks.coding.IllegalCatchCheck:92:100 --regex .*.checks.coding.PackageDeclarationCheck:63:50 --regex .*.checks.SuppressWarningsHolder:90:70 --regex .*.checks.indentation.IndentationCheck:93:100 --regex .*.filters.SuppressionFilter:0:0 --regex .*.api.JavadocTokenTypes:0:100 --regex .*.checks.NewlineAtEndOfFileCheck:88:83 --regex .*.checks.imports.AvoidStarImportCheck:88:90 --regex .*.checks.indentation.ObjectBlockHandler:100:75 --regex .*.filters.SuppressionsLoader:77:68 --regex .*.checks.annotation.AnnotationUseStyleCheck:96:93 --regex .*.checks.design.InterfaceIsTypeCheck:85:100 --regex .*.checks.coding.IllegalThrowsCheck:84:93 --regex .*.checks.regexp.SinglelineDetector:96:93 --regex .*.checks.indentation.SynchronizedHandler:100:100 --regex .*.checks.coding.AbstractNestedDepthCheck:86:100 --regex .*.XMLLogger:97:86 --regex .*.checks.design.VisibilityModifierCheck:95:95 --regex .*.api.AbstractLoader:88:75 --regex .*.api.Comment:95:100 --regex .*.checks.coding.OverloadMethodsDeclarationOrderCheck:96:93 --regex .*.checks.sizes.ParameterNumberCheck:93:100 --regex .*.checks.javadoc.JavadocStyleCheck:97:89 --regex .*.Main:78:65 --regex .*.checks.coding.MultipleStringLiteralsCheck:94:90 --regex .*.checks.javadoc.TagParser:98:92 --regex .*.ConfigurationLoader\$.*:84:65 --regex .*.checks.blocks.EmptyCatchBlockCheck:98:96 --regex .*.checks.coding.EqualsAvoidNullCheck:96:78 --regex .*.checks.javadoc.JavadocPackageCheck:95:80 --regex .*.checks.coding.IllegalTokenTextCheck:88:60 --regex .*.checks.naming.LocalFinalVariableNameCheck:85:87 --regex .*.checks.whitespace.WhitespaceAfterCheck:90:90 --regex .*.DefaultConfiguration:92:100 --regex .*.checks.imports.UnusedImportsCheck:97:90 --regex .*.filters.SuppressionCommentFilter\$.*:69:41 --regex .*.checks.imports.ImportOrderCheck:99:91 --regex .*.api.FileText:59:50 --regex .*.checks.blocks.NeedBracesCheck:97:80 --regex .*.checks.annotation.SuppressWarningsCheck:96:79 --regex .*.checks.imports.ImportControlCheck:70:85 --regex .*.checks.regexp.RegexpSinglelineCheck:76:100 --regex .*.checks.modifier.ModifierOrderCheck:91:92 --regex .*.checks.metrics.AbstractComplexityCheck:92:83 --regex .*.filters.SuppressElement:88:82 --regex .*.filters.SuppressWithNearbyCommentFilter:89:76 --regex .*.checks.indentation.LineWrappingHandler:91:87 --regex .*.checks.javadoc.AbstractJavadocCheck\$.*:68:50 --regex .*.checks.coding.AbstractSuperCheck:88:78 --regex .*.api.AutomaticBean\$.*:90:75 --regex .*.checks.blocks.AvoidNestedBlocksCheck:90:100 --regex .*.checks.coding.NestedIfDepthCheck:83:75 --regex .*.checks.javadoc.JavadocNodeImpl:84:50 --regex .*.Checker:84:79 --regex .*.checks.coding.CovariantEqualsCheck:90:95 --regex .*.ConfigurationLoader:79:86 --regex .*.checks.metrics.CyclomaticComplexityCheck:80:85 --regex .*.checks.javadoc.JavadocParagraphCheck:100:92 --regex .*.checks.sizes.MethodLengthCheck:95:100 --regex .*.checks.sizes.OuterTypeNumberCheck:94:75 --regex .*.checks.coding.OneStatementPerLineCheck:96:93 --regex .*.filters.SuppressWithNearbyCommentFilter\$Tag:78:88 --regex .*.Definitions:0:100 --regex .*.api.AnnotationUtility:0:0 --regex .*.checks.indentation.ArrayInitHandler:97:83 --regex .*.checks.imports.IllegalImportCheck:94:100 --regex .*.checkstyle.ScopeUtils:94:90 --regex .*.checks.coding.ArrayTrailingCommaCheck:90:100 --regex .*.checks.coding.EmptyStatementCheck:80:100 --regex .*.checks.sizes.LineLengthCheck:89:100 --regex .*.checks.javadoc.JavadocTag:85:92 --regex .*.checks.whitespace.NoWhitespaceAfterCheck:98:94 --regex .*.PackageNamesLoader:72:78 --regex .*.checks.naming.AbbreviationAsWordInNameCheck:100:93 --regex .*.checks.indentation.MethodDefHandler:100:87 --regex .*.checks.coding.NestedForDepthCheck:90:50 --regex .*.checks.javadoc.JavadocVariableCheck:90:93 --regex .*.filters.IntMatchFilter:90:100 --regex .*.api.DetailAST:98:95 --regex .*.checks.annotation.AnnotationLocationCheck:78:75 --regex .*.checks.coding.ExplicitInitializationCheck:90:90 --regex .*.checks.header.HeaderCheck:45:18 --regex .*.checks.whitespace.SeparatorWrapCheck:93:100 --regex .*.checks.header.AbstractHeaderCheck:85:85 --regex .*.checks.design.InnerTypeLastCheck:93:100"
[DEBUG] exit code: 1
[DEBUG] --------------------
[DEBUG] Standard error from the Cobertura task:
[DEBUG] --------------------
[ERROR] The command line is too long.
Now that eCobertura is installed, restart Eclipse and show the coverage session view under Windows → Show View → Other → Cobertura.
A code coverage utility for Java. Cobertura is a free Java tool that calculates the percentage of code accessed by tests. It can be used to identify which parts of your Java program are lacking test coverage. It is based on jcoverage.
start test in web interface ( by default localhost:9000/@tests) and go to your_host:your_port/@cobertura ( by default it's http://localhost:9000/@cobertura ) for generate new report or reset previous. And now you can see html report in iframe or directly on file:/path/to/your/application/test-result/code-coverage/.
One solution I can suggest is to install cygwin and run command there. You can find how to run through cygwin any internet. Try This Tutorial
Also instead calling CheckCoverageMain directly using java you can write an ant script, which will call CheckCoverageMain and pass the arguments from their like below,
<java classname="net.sourceforge.cobertura.check.CheckCoverageMain" fork="true">
<jvmarg value="--regex"/>
And then call the ant script from command line. Ant script basic tutorial
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With