1 package org.apache.maven.it;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.it.util.ResourceExtractor;
23
24 import java.io.File;
25 import java.util.Arrays;
26
27 public class MavenITmng6562WarnDefaultBindings
28 extends AbstractMavenIntegrationTestCase
29 {
30
31 public MavenITmng6562WarnDefaultBindings()
32 {
33 super( "[4.0.0-alpha-1,)" );
34 }
35
36 public void testItShouldNotWarn()
37 throws Exception
38 {
39 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6562-default-bindings" );
40
41 String phase = "validate";
42 Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
43 verifier.setAutoclean( false );
44 verifier.setLogFileName( phase + ".txt" );
45 verifier.setForkJvm( true );
46 verifier.addCliOption( "-fos" );
47 verifier.addCliOption( "WARN" );
48 verifier.executeGoals( Arrays.asList( phase ) );
49 verifier.resetStreams();
50
51 verifier.verifyErrorFreeLog();
52 }
53
54
55 public void testItShouldNotWarn2()
56 throws Exception
57 {
58 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6562-default-bindings" );
59
60 String phase = "process-resources";
61 Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
62 verifier.setAutoclean( false );
63 verifier.setLogFileName( phase + ".txt" );
64 verifier.setForkJvm( true );
65 verifier.addCliOption( "-fos" );
66 verifier.addCliOption( "WARN" );
67 verifier.executeGoals( Arrays.asList( phase ) );
68 verifier.resetStreams();
69
70 verifier.verifyErrorFreeLog();
71 }
72
73 public void testItShouldWarnForCompilerPlugin()
74 throws Exception
75 {
76 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6562-default-bindings" );
77
78 String phase = "compile";
79 Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
80 verifier.setAutoclean( false );
81 verifier.setLogFileName( phase +".txt" );
82 verifier.executeGoals( Arrays.asList( phase ) );
83 verifier.resetStreams();
84
85 verifier.verifyTextInLog( "Version not locked for default bindings plugins [maven-compiler-plugin]"
86 + ", you should define versions in pluginManagement section of your pom.xml or parent" );
87 }
88
89 public void testItShouldWarnForCompilerPlugin2()
90 throws Exception
91 {
92 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6562-default-bindings" );
93
94 String phase = "process-test-resources";
95 Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
96 verifier.setAutoclean( false );
97 verifier.setLogFileName( phase +".txt" );
98 verifier.executeGoals( Arrays.asList( phase ) );
99 verifier.resetStreams();
100 verifier.verifyErrorFreeLog();
101
102 verifier.verifyTextInLog( "Version not locked for default bindings plugins [maven-compiler-plugin]"
103 + ", you should define versions in pluginManagement section of your pom.xml or parent" );
104 }
105
106 public void testItShouldWarnForCompilerPlugin3()
107 throws Exception
108 {
109 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6562-default-bindings" );
110
111 String phase = "test-compile";
112 Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
113 verifier.setAutoclean( false );
114 verifier.setLogFileName( phase +".txt" );
115 verifier.executeGoals( Arrays.asList( phase ) );
116 verifier.resetStreams();
117 verifier.verifyErrorFreeLog();
118
119 verifier.verifyTextInLog( "Version not locked for default bindings plugins [maven-compiler-plugin]"
120 + ", you should define versions in pluginManagement section of your pom.xml or parent" );
121 }
122
123 public void testItShouldWarnForCompilerPluginAndSurefirePlugin()
124 throws Exception
125 {
126 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6562-default-bindings" );
127
128 String phase = "test";
129 Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
130 verifier.setAutoclean( false );
131 verifier.setLogFileName( phase +".txt" );
132 verifier.executeGoals( Arrays.asList( phase ) );
133 verifier.resetStreams();
134 verifier.verifyErrorFreeLog();
135
136 verifier.verifyTextInLog( "Version not locked for default bindings plugins [maven-compiler-plugin, maven-surefire-plugin]"
137 + ", you should define versions in pluginManagement section of your pom.xml or parent" );
138 }
139
140 }