Mojofailureexception caused by charsetName in Maven Archetype

Asked

Viewed 148 times

5

A WAR project I’m trying to use as a base to run mvn archetype:create-from-project causes the following Exception stack after trying to read one of the files .java:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:create-from-project (default-cli) on project ConfiguradorWAR: charsetName -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:create-from-project (default-cli) on project ConfiguradorWAR: charset
Name
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: charsetName
        at org.apache.maven.archetype.mojos.CreateArchetypeFromProjectMojo.execute(CreateArchetypeFromProjectMojo.java:285)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 19 more

The default encoding of the editor and the project is Cp1252, I’ve tried with UTF-8 and ISO-8859-1, I changed both the preferences of the editor, the project and the Maven in

    <properties>
            <project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding> 
            <project.reporting.outputEncoding>${project.build.sourceEncoding}</project.reporting.outputEncoding>
            <project.resources.sourceEncoding>${project.build.sourceEncoding}</project.resources.sourceEncoding>
    </properties>

and

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-archetype-plugin</artifactId>
    <version>2.2</version>
    <configuration>
        <defaultEncoding>${project.build.sourceEncoding}</defaultEncoding>
        <encoding>${project.build.sourceEncoding}</encoding>
        <archetypeArtifactId>archetype-wsjpa</archetypeArtifactId>
                        <archetypeGroupId>br.com.example</archetypeGroupId>
                        <archetypeVersion>1.0</archetypeVersion>                              <archetypeFilteredExtentions>java,xml</archetypeFilteredExtentions>
    </configuration>
 </plugin>
 <plugin>
     <artifactId>maven-compiler-plugin</artifactId>
     <version>3.1</version>
     <configuration>
         <encoding>${project.build.sourceEncoding}</encoding>
     </configuration>
 </plugin>
 <plugin>
     <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-war-plugin</artifactId>
      <version>2.3</version>
      <configuration>
          <archive>
              <manifest>
                  <addClasspath>true</addClasspath>
                  <classpathPrefix>lib/</classpathPrefix>
             </manifest>
          </archive>
          <warSourceDirectory>${basedir}/src/main/webapp</warSourceDirectory>
        <webResources>
            <resource>
                <directory>${basedir}/src/main/webapp/images</directory>                          <directory>${basedir}/src/main/webapp/portalVAS/images</directory>
             </resource>
        </webResources>
    </configuration>
</plugin>

The best advice I’ve had from co-workers so far is to try to give replace of all the accents of the project. I have another EJB project with the same understanding that the archetype worked at first.

  • The ideal would be to always use UTF-8. Do you have the XML snippet you use to package WAR? What is the encoding of your pom.xml?

  • @Victorstafusa the pom.xml is UTF-8, the pack is done via apache plugin, I will include in the question.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.