svn-gvsig-desktop / trunk / org.gvsig.desktop / maven-howto.rst @ 40435
History | View | Annotate | Download (4.06 KB)
1 | 40435 | jjdelcerro | |
---|---|---|---|
2 | - How to reduce the process of "install" to run as fast as possible. |
||
3 | Can reduce install execution skiping test execution and compilation, |
||
4 | javadoc generation and test signature checking. |
||
5 | |||
6 | mvn -Dmaven.test.skip=true -DskipTests -Dmaven.javadoc.skip=true -Danimal.sniffer.skip=true install |
||
7 | |||
8 | - How to skip test compile from command line:: |
||
9 | |||
10 | mvn -Dmaven.test.skip=true install |
||
11 | |||
12 | - How to skip test execution from command line:: |
||
13 | |||
14 | mvn -DskipTests install |
||
15 | |||
16 | - How to skip javadoc generation from command line:: |
||
17 | |||
18 | mvn -Dmaven.javadoc.skip=true install |
||
19 | |||
20 | - How to skip test signature cheks from command line:: |
||
21 | |||
22 | mvn -Danimal.sniffer.skip=true install |
||
23 | |||
24 | - How to install a project without install submodules |
||
25 | |||
26 | mvn --non-recursive install |
||
27 | |||
28 | - How to skip test compilation:: |
||
29 | |||
30 | <build> |
||
31 | <plugins> |
||
32 | ... |
||
33 | <plugin> |
||
34 | <!-- Skip compilation tests --> |
||
35 | <groupId>org.apache.maven.plugins</groupId> |
||
36 | <artifactId>maven-compiler-plugin</artifactId> |
||
37 | <executions> |
||
38 | <execution> |
||
39 | <id>default-testCompile</id> |
||
40 | <phase>process-test-sources</phase> |
||
41 | <goals> |
||
42 | <goal>testCompile</goal> |
||
43 | </goals> |
||
44 | <configuration> |
||
45 | <skip>true</skip> |
||
46 | </configuration> |
||
47 | </execution> |
||
48 | </executions> |
||
49 | </plugin> |
||
50 | ... |
||
51 | </plugins> |
||
52 | </build> |
||
53 | |||
54 | - Skip test execution:: |
||
55 | |||
56 | <build> |
||
57 | <plugins> |
||
58 | ... |
||
59 | <plugin> |
||
60 | <!-- Skip test execution --> |
||
61 | <groupId>org.apache.maven.plugins</groupId> |
||
62 | <artifactId>maven-surefire-plugin</artifactId> |
||
63 | <configuration> |
||
64 | <skipTests>true</skipTests> |
||
65 | </configuration> |
||
66 | </plugin> |
||
67 | ... |
||
68 | </plugins> |
||
69 | </build> |
||
70 | |||
71 | - Continue on test failure :: |
||
72 | |||
73 | <build> |
||
74 | <plugins> |
||
75 | ... |
||
76 | <plugin> |
||
77 | <!-- Continue on test failure --> |
||
78 | <groupId>org.apache.maven.plugins</groupId> |
||
79 | <artifactId>maven-surefire-plugin</artifactId> |
||
80 | <configuration> |
||
81 | <testFailureIgnore>true</testFailureIgnore> |
||
82 | </configuration> |
||
83 | </plugin> |
||
84 | ... |
||
85 | </plugins> |
||
86 | </build> |
||
87 | |||
88 | |||
89 | - Set java compatibility:: |
||
90 | |||
91 | <build> |
||
92 | <plugins> |
||
93 | ... |
||
94 | <plugin> |
||
95 | <!-- Set java compatibility --> |
||
96 | <groupId>org.apache.maven.plugins</groupId> |
||
97 | <artifactId>maven-compiler-plugin</artifactId> |
||
98 | <configuration> |
||
99 | <source>1.5</source> |
||
100 | <target>1.5</target> |
||
101 | <encoding>ISO-8859-1</encoding> |
||
102 | </configuration> |
||
103 | </plugin> |
||
104 | ... |
||
105 | </plugins> |
||
106 | </build> |
||
107 | |||
108 | - Packaging tests in jar |
||
109 | |||
110 | Test classes do not packaging in jar by default. |
||
111 | To packing add to pom:: |
||
112 | |||
113 | <build> |
||
114 | <plugins> |
||
115 | ... |
||
116 | <plugin> |
||
117 | <!-- Packaging tests in jar --> |
||
118 | <groupId>org.apache.maven.plugins</groupId> |
||
119 | <artifactId>maven-jar-plugin</artifactId> |
||
120 | <executions> |
||
121 | <!-- Generates a jar file only with the test classes --> |
||
122 | <execution> |
||
123 | <goals> |
||
124 | <goal>test-jar</goal> |
||
125 | </goals> |
||
126 | <configuration> |
||
127 | <includes> |
||
128 | <include>**/**</include> |
||
129 | </includes> |
||
130 | </configuration> |
||
131 | </execution> |
||
132 | </executions> |
||
133 | </plugin> |
||
134 | ... |
||
135 | </plugins> |
||
136 | </build> |
||
137 | |||
138 | - How to set a dependency with tests jar:: |
||
139 | |||
140 | <dependency> |
||
141 | <groupId>...</groupId> |
||
142 | <artifactId>...</artifactId> |
||
143 | <type>test-jar</type> |
||
144 | <scope>test</scope> |
||
145 | </dependency> |
||
146 | |||
147 | - How use ant in maven:: |
||
148 | |||
149 | <plugin> |
||
150 | <artifactId>maven-antrun-plugin</artifactId> |
||
151 | <version>1.7</version> |
||
152 | <executions> |
||
153 | <execution> |
||
154 | <phase>generate-sources</phase> |
||
155 | <configuration> |
||
156 | <target> |
||
157 | <echo>Hello world!</echo> |
||
158 | </target> |
||
159 | </configuration> |
||
160 | <goals> |
||
161 | <goal>run</goal> |
||
162 | </goals> |
||
163 | </execution> |
||
164 | </executions> |
||
165 | </plugin> |