I'm having problems getting the ant mail task working when running from
the antrun plugin, the pom and ant build files I use to highlight this
issue are below
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.mail.test</groupId>
<artifactId>mail-test</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>mail-test</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>Test for email sending</id>
<phase>compile</phase>
<configuration>
<tasks>
<ant antfile="${basedir}/build.xml"
inheritRefs="true">
<target name="send-email-notification"/>
</ant>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0"?>
<project name="mail-test">
<target name="send-email-notification">
<mail mailhost="my.mail.host.com" mailport="465" ssl="false"
subject="testing 1 2 3">
<from address="m...@mine.com" />
<to address="m...@mine.com" />
<message>This is a test email</message>
</mail>
</target>
</project>
When I run
mvn compile
the following error occurs and no email is sent.
[INFO] Scanning for projects...
[INFO]
------------------------------------------------------------------------
[INFO] Building mail-test
[INFO] task-segment: [compile]
[INFO]
------------------------------------------------------------------------
[INFO] [resources:resources]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory
/home/development/Desktop/src/main/resources
[INFO] [compiler:compile]
[INFO] No sources to compile
[INFO] [antrun:run {execution: Test for email sending}]
[INFO] Executing tasks
send-email-notification:
[mail] Failed to initialise MIME mail:
org.apache.tools.ant.taskdefs.email.MimeMailer
[INFO] Executed tasks
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Fri May 22 08:44:45 EST 2009
[INFO] Final Memory: 8M/108M
[INFO]
------------------------------------------------------------------------
If I run the ant script directly ie "ant send-email-notification" it
works fine. I have the mail and activation jars in the ANT_HOME/lib
directory.
My environement is:
mvn -v
Apache Maven 2.1.0 (r755702; 2009-03-19 06:10:27+1100)
Java version: 1.6.0_06
Java home: /usr/java/jdk1.6.0_06/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.26.8-57.fc8" arch: "i386" Family: "unix"
ant -v
Apache Ant version 1.7.1 compiled on June 27 2008
Buildfile: build.xml
Detected Java version: 1.6 in: /usr/java/jdk1.6.0_06/jre
Detected OS: Linux
parsing buildfile /home/development/Desktop/build.xml with URI =
file:/home/development/Desktop/build.xml
Project base dir set to: /home/development/Desktop
BUILD SUCCESSFUL
Total time: 0 seconds
Any help would be greatly appreciated.
Cheers
Matt Milliss
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org