maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Russell Gold <r...@gold-family.us>
Subject Re: How can I get error output for maven-antrun-plugin (if=fail) error?
Date Fri, 21 Jun 2013 00:05:25 GMT
That seems odd, since you're showing the ant task as bound to the package phase - and from
what you're saying, it shouldn't reach that phase.

How are you invoking maven? Why don't you try:

mvn test

That should not even try to get to the package phase and the ant plugin.

- Russ

On Jun 20, 2013, at 3:31 PM, "Morrisey, Russell" <rmorrise@cscinfo.com> wrote:

> All,
> 
> I'm troubleshooting a build error from the maven-antrun-plugin (maven 2.2.1). Any help
would be appreciated.
> 
> I know that there is a unit test failure in the build. Something about our config is
masking the root cause of the error.
> 
> I get the following output in the build:
> 
> [INFO] ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO] ------------------------------------------------------------------------
> [INFO] An Ant BuildException has occured: if=error
> [INFO] ------------------------------------------------------------------------
> [INFO] Trace
> org.apache.maven.lifecycle.LifecycleExecutionException: An Ant BuildException has occured:
if=error
> 
> I expected to get something looking like this, instead:
> 
> Tests in error:
>  testMethod(com.mycompany.MyTest)
> 
> Tests run: 257, Failures: 0, Errors: 1, Skipped: 2
> 
> [INFO] ------------------------------------------------------------------------
> [INFO] Reactor Summary:
> [INFO]
> ...
> [INFO] my-project .................................... FAILURE [51.159s]
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 1:04.929s
> [INFO] Finished at: Thu Jun 20 15:12:43 EDT 2013
> [INFO] Final Memory: 237M/512M
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.11:test
(d
> efault-test) on project scheduler-core: There are test failures.
> [ERROR]
> [ERROR] Please refer to C:\my-project\target\surefire-reports
> for the individual test results.
> 
> Why am I getting this strange antrun error, instead of my maven-surefire-plugin error?
> (Note the above 'expected' output was generated using maven 3.0.4. I need to make the
project behave itself, and give me similarly useful results, when built using mvn 2.)
> 
> The antrun part of my configuration looks like this:
> 
>                        <groupId>org.apache.maven.plugins</groupId>
>                        <artifactId>maven-antrun-plugin</artifactId>
>                        <executions>
>                            <execution>
>                                <id>test-reports</id>
>                                <phase>package</phase>
>                                <configuration>
>                                    <tasks>
> 
>                                        <property name="compile_classpath" refid="maven.compile.classpath"
/>
>                                        <property name="runtime_classpath" refid="maven.runtime.classpath"
/>
>                                        <property name="test_classpath" refid="maven.test.classpath"
/>
>                                        <property name="plugin_classpath" refid="maven.plugin.classpath"
/>
> 
>                                        <delete dir="../target/site" failonerror="false"
/>
>                                        <delete dir="../target/surefire-reports" failonerror="false"
/>
>                                        <mkdir dir="../target/site" />
>                                        <mkdir dir="../target/surefire-reports" />
>                                        <copy todir="../target/surefire-reports" failonerror="false"
flatten="true" verbose="true">
>                                            <fileset dir="../">
>                                                <include name="**/surefire-reports/TEST-*.xml"
/>
>                                            </fileset>
>                                        </copy>
> 
> 
>                                        <concat destfile="../target/surefire-reports/all.txt">
>                                            <fileset dir="../">
>                                                <include name="**/surefire-reports/TEST-*.xml"
/>
>                                            </fileset>
>                                        </concat>
> 
>                                        <loadfile property="fail" srcFile="../target/surefire-reports/all.txt"
failonerror="false">
>                                            <filterchain>
>                                                <linecontains>
>                                                    <contains value="&lt;fail"
/>
>                                                </linecontains>
>                                            </filterchain>
>                                        </loadfile>
> 
>                                        <loadfile property="error" srcFile="../target/surefire-reports/all.txt"
failonerror="false">
>                                            <filterchain>
>                                                <linecontains>
>                                                    <contains value="&lt;error"
/>
>                                                </linecontains>
>                                            </filterchain>
>                                        </loadfile>
> 
>                                        <fail if="fail"/>
>                                        <fail if="error"/>
>                                    </tasks>
>                                </configuration>
>                                <goals>
>                                    <goal>run</goal>
>                                </goals>
>                            </execution>
>                        </executions>
>                        <dependencies></dependencies>
> 
> Thanks,
> 
> Russell Morrisey
> Java Developer - Entity Risk Management
> Corporation Service Company<http://www.incspot.com/>
> 2711 Centerville Road, Wilmington, DE  19808
> E-mail: rmorrise@cscinfo.com<mailto:rmorrise@cscinfo.com>
> 
> 
> ________________________________
> 
> NOTICE: This e-mail and any attachments is intended only for use by the addressee(s)
named herein and may contain legally privileged, proprietary or confidential information.
If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this email, and any attachments thereto, is strictly prohibited.
If you receive this email in error please immediately notify me via reply email or at (800)
927-9800 and permanently delete the original copy and any copy of any e-mail, and any printout.

-----------------
Come read my webnovel, Take a Lemon <http://www.takealemon.com>, 
and listen to the Misfile radio play <http://www.gold-family.us/audio/misfile.html>!





Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message