Hi

On a multi-module project, I have the ant:ant goal working fine.  However,
on a much simpler project based on the simples archetype, I get a ClassCast
exception.  Has anyone had/solved this issue before?

Thanks!

Gary

Stack trace and POM file below

java.lang.ClassCastException: java.util.HashMap cannot be cast to
java.lang.String at
org.apache.maven.plugin.ant.AntBuildWriterUtil.getMavenPluginBasicOption(
AntBuildWriterUtil.java:902)
        at
org.apache.maven.plugin.ant.AntBuildWriterUtil.getMavenJarPluginBasicOption(
AntBuildWriterUtil.java:838)
        at org.apache.maven.plugin.ant.AntBuildWriterUtil.writeJarTask(
AntBuildWriterUtil.java:572)
        at org.apache.maven.plugin.ant.AntBuildWriter.writePackageTarget(
AntBuildWriter.java:909)
        at org.apache.maven.plugin.ant.AntBuildWriter.writeGeneratedBuildXml
(AntBuildWriter.java:304)
        at org.apache.maven.plugin.ant.AntBuildWriter.writeBuildXmls(
AntBuildWriter.java:112)
        at org.apache.maven.plugin.ant.AntMojo.execute(AntMojo.java:112)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(
DefaultPluginManager.java:443)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
DefaultLifecycleExecutor.java:539)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(
DefaultLifecycleExecutor.java:493)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(
DefaultLifecycleExecutor.java:463)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
(DefaultLifecycleExecutor.java:311)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
DefaultLifecycleExecutor.java:278)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
DefaultLifecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java
:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java
:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

POM

<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>com.elgaz.smart</groupId>
  <artifactId>demo-app</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>demo-app</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
  <plugins>
  <plugin>
     <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>

<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>

<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            </manifest>
          </archive>
        </configuration>
  </plugin>
<plugin>
       <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                <descriptorRefs>
                <descriptorRef>bin</descriptorRef>
                </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>attached</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                </executions>
            </plugin>
<plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                  <generatePackage>com.demo.address</generatePackage>
                   </configuration>
            </plugin>
<plugin>
                <inherited>true</inherited>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
    <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <echo>ANT IS RUNNING!!!</echo>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
    </plugins>
  </build>
 <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
    </plugins>
</reporting>
   <pluginRepositories>
        <pluginRepository>
            <id>maven2-repository.dev.java.net </id>
            <name>Java.net Maven 2 Repository</name>
            <url> http://download.java.net/maven/2</url>
        </pluginRepository>
    </pluginRepositories>
</project>

Reply via email to