Files
maven-plugins/test/xdocs/index.xml
2007-05-01 19:56:05 +00:00

87 lines
3.3 KiB
XML

<?xml version="1.0"?>
<!--
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<document>
<properties>
<title>Maven Test Plugin</title>
<author email="jason@zenplex.com">Jason van Zyl</author>
</properties>
<body>
<section name="Maven Test Plugin">
<p>
This plug-in provides your basic JUnit testing facilities.
</p>
</section>
<section name="Requirements">
<p>
Be careful, the following plugins must be installed to use
version 1.8 of the test plugin:
</p>
<ul>
<li>maven-jar-plugin 1.8 (at least)</li>
</ul>
</section>
<section name="Backward compatibility issue with version 1.8">
<p>
Version 1.8 of the test plugin removed a prereq on <code>java:compile</code>
&amp; <code>java:jar-resources</code> from the <code>test:test</code> goal
for optimization reasons (see <a href="http://jira.codehaus.org/browse/MPTEST-46">MPTEST-46</a>).
This introduced a backward compatibility issue
(see <a href="http://jira.codehaus.org/browse/MPTEST-66">MPTEST-66</a>)
which might affect you if the following conditions are met:
</p>
<ul>
<li>
You either use <code>maven.test.skip=true</code> or your project has no unit tests.
</li>
<li>
Either your project, or a plugin that you use, relies on java sources to be compiled
by calling the <code>test:test</code> goal.
</li>
</ul>
<p>
An illustration of the problem is provided by the
<a href="http://maven-plugins.sourceforge.net/maven-javaapp-plugin/index.html">javaapp</a>
sourceforge plugin, whose <code>javaapp:jar</code> goal has a prereq on <code>test:test</code>,
relying on the java sources to be compiled by this call. If you are calling this goal now with
a project that has no tests, the build will fail.
</p>
<p>
The problem should really be fixed in the corresponding plugin,
but a simple workaround is to add the missing goals as a preGoal
in your maven.xml:
</p>
<source><![CDATA[<preGoal name="javaapp:jar">
<j:if test="${unitTestSourcesPresent != 'true' or context.getVariable('maven.test.skip') == 'true'}">
<attainGoal name="java:compile"/>
<attainGoal name="java:jar-resources"/>
</j:if>
</preGoal>]]></source>
<p>
If you don't know the goal that is causing the trouble, you may add
the preGoal to <code>test:test</code>, but this might lead
to double compilation.
</p>
</section>
</body>
</document>