configuration/check/haltOnFailure=true
in the plugin's
27 | * configuration.
28 | *
29 | * @author Dennis Lundberg
30 | * @goal check-integration-test
31 | * @execute phase="verify" lifecycle="cobertura"
32 | */
33 | public class CoberturaCheckIntegrationTestMojo extends CoberturaCheckMojo
34 | {
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/org/codehaus/mojo/cobertura/CoberturaCheckMojo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * Mojo's Maven plugin for Cobertura
4 | * %%
5 | * Copyright (C) 2005 - 2013 Codehaus
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package org.codehaus.mojo.cobertura;
21 |
22 | import org.apache.maven.artifact.handler.ArtifactHandler;
23 | import org.apache.maven.plugin.MojoExecutionException;
24 | import org.apache.maven.plugin.MojoFailureException;
25 | import org.codehaus.mojo.cobertura.configuration.ConfigCheck;
26 | import org.codehaus.mojo.cobertura.tasks.CheckTask;
27 |
28 | /**
29 | * Check the coverage percentages for unit tests from the last instrumentation,
30 | * and optionally fail the build if the targets are not met. To fail the build
31 | * you need to set
32 | * configuration/check/haltOnFailure=true
in the plugin's
33 | * configuration.
34 | *
35 | * @author Joakim Erdfelt
36 | * @goal check
37 | * @execute phase="test" lifecycle="cobertura"
38 | * @phase verify
39 | */
40 | public class CoberturaCheckMojo
41 | extends AbstractCoberturaMojo
42 | {
43 | /**
44 | * The Check Configuration.
45 | *
46 | * @parameter
47 | * @required
48 | */
49 | private ConfigCheck check;
50 |
51 | /**
52 | * {@inheritDoc}
53 | */
54 | public void execute()
55 | throws MojoExecutionException, MojoFailureException
56 | {
57 | if ( skipMojo() )
58 | {
59 | return;
60 | }
61 |
62 | ArtifactHandler artifactHandler = getProject().getArtifact().getArtifactHandler();
63 | if ( !"java".equals( artifactHandler.getLanguage() ) )
64 | {
65 | getLog().info(
66 | "Not executing cobertura:instrument as the project is not a Java classpath-capable package" );
67 | }
68 | else
69 | {
70 | if ( !getDataFile().exists() )
71 | {
72 | getLog().info( "Cannot perform check, instrumentation not performed - skipping." );
73 | }
74 | else
75 | {
76 | CheckTask task = new CheckTask();
77 | setTaskDefaults( task );
78 | task.setConfig( check );
79 | task.setDataFile( getDataFile().getAbsolutePath() );
80 |
81 | task.execute();
82 | }
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/main/java/org/codehaus/mojo/cobertura/CoberturaCleanMojo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * Mojo's Maven plugin for Cobertura
4 | * %%
5 | * Copyright (C) 2005 - 2013 Codehaus
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package org.codehaus.mojo.cobertura;
21 |
22 | import org.apache.maven.plugin.MojoExecutionException;
23 | import org.apache.maven.plugin.MojoFailureException;
24 |
25 | /**
26 | * Clean up the files that Cobertura Maven Plugin has created during
27 | * instrumentation.
28 | *
29 | * @author Joakim Erdfelt
30 | * @goal clean
31 | * @phase clean
32 | */
33 | public class CoberturaCleanMojo
34 | extends AbstractCoberturaMojo
35 | {
36 | /**
37 | * {@inheritDoc}
38 | */
39 | public void execute()
40 | throws MojoExecutionException, MojoFailureException
41 | {
42 | if ( skipMojo() )
43 | {
44 | return;
45 | }
46 |
47 | if ( getDataFile().exists() )
48 | {
49 | getDataFile().delete();
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/org/codehaus/mojo/cobertura/CoberturaMojoUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * Mojo's Maven plugin for Cobertura
4 | * %%
5 | * Copyright (C) 2005 - 2013 Codehaus
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package org.codehaus.mojo.cobertura;
21 |
22 | import org.apache.maven.plugin.MojoExecution;
23 |
24 | import java.io.File;
25 |
26 | /**
27 | * Utility class which can be used by both build-plugins and reports
28 | *
29 | * @author Robert Scholte
30 | * @since 2.6
31 | */
32 | public class CoberturaMojoUtils
33 | {
34 |
35 | private CoberturaMojoUtils()
36 | {
37 | }
38 |
39 | /**
40 | * @param buildDirectory the buildDirectory
41 | * @param execution the mojo-execution
42 | * @return the data file
43 | */
44 | public static File getDataFile( File buildDirectory, MojoExecution execution )
45 | {
46 | return new File( buildDirectory, "cobertura/cobertura.ser" );
47 | }
48 | }
--------------------------------------------------------------------------------
/src/main/java/org/codehaus/mojo/cobertura/CoberturaReportIntegrationTestMojo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * Mojo's Maven plugin for Cobertura
4 | * %%
5 | * Copyright (C) 2005 - 2013 Codehaus
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package org.codehaus.mojo.cobertura;
21 |
22 | /**
23 | * Instrument the compiled classes, run the unit tests and integration tests
24 | * and generate a Cobertura report.
25 | *
26 | * @author Stevo Slavic
27 | * @goal cobertura-integration-test
28 | * @execute phase="verify" lifecycle="cobertura"
29 | */
30 | public class CoberturaReportIntegrationTestMojo extends CoberturaReportMojo
31 | {
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/org/codehaus/mojo/cobertura/configuration/Regex.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * Mojo's Maven plugin for Cobertura
4 | * %%
5 | * Copyright (C) 2005 - 2013 Codehaus
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package org.codehaus.mojo.cobertura.configuration;
21 |
22 | /**
23 | * @author Edwin Punzalan
24 | */
25 | public class Regex
26 | extends net.sourceforge.cobertura.ant.Regex
27 | {
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/org/codehaus/mojo/cobertura/tasks/CommandLineArguments.java:
--------------------------------------------------------------------------------
1 | /*
2 | * #%L
3 | * Mojo's Maven plugin for Cobertura
4 | * %%
5 | * Copyright (C) 2005 - 2013 Codehaus
6 | * %%
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * #L%
19 | */
20 | package org.codehaus.mojo.cobertura.tasks;
21 |
22 | import net.sourceforge.cobertura.util.CommandLineBuilder;
23 |
24 | import java.io.IOException;
25 | import java.util.ArrayList;
26 | import java.util.Iterator;
27 | import java.util.List;
28 |
29 | /**
30 | * CommandLineArguments allows for arbitrarily long command line argument lists.
31 | *
32 | * @author Joakim Erdfelt
33 | */
34 | public class CommandLineArguments
35 | {
36 | private ListWith <excludes/>
you define which files should be excluded from instrumentation.
26 | To filter out certain lines of the source code you can use <ignores/>
containing a regular expression.
27 |
See Cobertura Commandline Reference for further details.
29 |All | 14 |
org.apache.maven.shared.io.download | 17 |
org.apache.maven.shared.io.location | 20 |
org.apache.maven.shared.io.logging | 23 |
org.apache.maven.shared.io.scan | 26 |
org.apache.maven.shared.io.scan.mapping | 29 |
DefaultDownloadManager (95%) | 19 |
DownloadFailedException (100%) | 22 |
DownloadManager (N/A) | 25 |
ArtifactLocation (100%) | 19 |
ArtifactLocatorStrategy (100%) | 22 |
ClasspathResourceLocatorStrategy (100%) | 25 |
FileLocation (96%) | 28 |
FileLocatorStrategy (100%) | 31 |
Location (N/A) | 34 |
Locator (100%) | 37 |
LocatorStrategy (N/A) | 40 |
URLLocation (100%) | 43 |
URLLocatorStrategy (100%) | 46 |
DefaultMessageHolder (45%) | 19 |
MessageHolder (N/A) | 22 |
MessageLevels (82%) | 25 |
MessageSink (N/A) | 28 |
MojoLogSink (0%) | 31 |
MultiChannelMessageHolder (N/A) | 34 |
PlexusLoggerSink (0%) | 37 |
AbstractResourceInclusionScanner (0%) | 19 |
InclusionScanException (0%) | 22 |
ResourceInclusionScanner (N/A) | 25 |
SimpleResourceInclusionScanner (0%) | 28 |
StaleResourceScanner (0%) | 31 |
SingleTargetMapping (100%) | 19 |
SourceMapping (N/A) | 22 |
SuffixMapping (100%) | 25 |
Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
MultiChannelMessageHolder |
|
| 0.0;0 |
1 | 21 | | package org.apache.maven.shared.io.logging; |
2 | 23 | | |
3 | 25 | | |
4 | 27 | | public interface MultiChannelMessageHolder |
5 | 29 | | { |
6 | 31 | | |
7 | 33 | | } |