You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Gary Bauer <ga...@bigfoot.com> on 2007/10/04 08:38:03 UTC
ClassCastException in ant:ant
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>
Re: ClassCastException in ant:ant
Posted by Gary Bauer <ga...@bigfoot.com>.
Hmmm.. thanks lpezet. Removing the compiler plugin didn't fix my problem,
but removing the configuration of the maven-jar-plugin did! Seems there
could be a number of plug-ins that won't play nicely with ant:ant...
On 10/10/2007, lpezet <lp...@gmail.com> wrote:
>
>
> I have the same problem and it's because of my "<excludes>" in the
> compiler
> plugin somehow:
> <plugin>
> <artifactId>maven-compiler-plugin</artifactId>
> <configuration>
> <source>1.5</source>
> <target>1.5</target>
> <excludes>
> <exclude>**/.svn/**</exclude>
> </excludes>
> </configuration>
> </plugin>
>
> When I get rid of it, it works fine.
>
> Anyone to shed a light on those problems?
>
>
> Gary Bauer-2 wrote:
> >
> > 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>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/ClassCastException-in-ant%3Aant-tf4566110s177.html#a13127652
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
--
===========================================
Check out my website at http://elgaz.wordpress.com
Re: ClassCastException in ant:ant
Posted by lpezet <lp...@gmail.com>.
Looks like the the compiler plugin with 1.5 is causing problem:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
Can you try removing that section and do another mvn ant:ant?
Gary Bauer-2 wrote:
>
> 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>
>
>
--
View this message in context: http://www.nabble.com/ClassCastException-in-ant%3Aant-tf4566110s177.html#a13127652
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: ClassCastException in ant:ant
Posted by lpezet <lp...@gmail.com>.
I have the same problem and it's because of my "<excludes>" in the compiler
plugin somehow:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<excludes>
<exclude>**/.svn/**</exclude>
</excludes>
</configuration>
</plugin>
When I get rid of it, it works fine.
Anyone to shed a light on those problems?
Gary Bauer-2 wrote:
>
> 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>
>
>
--
View this message in context: http://www.nabble.com/ClassCastException-in-ant%3Aant-tf4566110s177.html#a13127652
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: ClassCastException in ant:ant
Posted by lpezet <lp...@gmail.com>.
I have the same problem and it's because of my "<excludes>" in the compiler
plugin somehow:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<excludes>
<exclude>**/.svn/**</exclude>
</excludes>
</configuration>
</plugin>
When I get rid of it, it works fine.
Anyone to shed a light on those problems?
Can you try removing that section and do another mvn ant:ant?
Gary Bauer-2 wrote:
>
> 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>
>
>
--
View this message in context: http://www.nabble.com/ClassCastException-in-ant%3Aant-tf4566110s177.html#a13127652
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org