Garbled problem with AppFuse 3

Source: Internet
Author: User

Book on the Back : AppFuse 3 common problems and solutions, a new problem: garbled! In the 3.0.0 version, the MVN appfuse:full-source command after the execution of the MVN Jetty:run start the project, the page is garbled. What I'm saying is that this garbled question is very interesting, and the interesting thing about it is that the final solution looks too far away from the problem. The workaround is to find the configuration of the hibernate3-maven-plugin in the Pom, commenting out the <executions/> part, i.e. not performing hbm2ddl in the process-test-resources phase. (If you need to export the schema to the database, you can manually execute the MVN hibernate3:hbm2ddl, which is more in line with the actual development needs). Yes, it doesn't seem to matter, but the problem is here! Let's go back down to the point where the problem occurs, and then step by step. This article source: http://blog.csdn.net/bluishglc/article/details/38640715 prohibited any form of reprint, or will entrust CSDN official maintenance rights!

First, look at the compiled output directory target/classes under the Chinese properties file, you can determine that the file itself is not transcoded, is the Native2ascii plugin does not work properly? By checking, the problem is not found on native2ascii-maven-plugin configuration. Using MVN clean package-x to view the log information in Maven execution, the following interesting output was found:

[Debug]-----------------------------------------------------------------------[Debug] Goal:org.apache.maven.plu  Gins:maven-resources-plugin:2.6:resources (default-resources) [DEBUG] style:regular[debug] Configuration: <?xml Version= "1.0" encoding= "UTF-8"?><configuration> <buildfilters default-value= "${project.build.filters} "/> <encoding default-value=" ${project.build.sourceencoding} ">${encoding}</encoding> < Escapestring>${maven.resources.escapestring}</escapestring> <escapewindowspaths default-value= "true" >${maven.resources.escapeWindowsPaths}</escapeWindowsPaths> <includeemptydirs default-value= "false" >${maven.resources.includeEmptyDirs}</includeEmptyDirs> <outputdirectory default-value= "${ Project.build.outputDirectory} "/> <overwrite default-value=" false ">${maven.resources.overwrite}</ overwrite> <project default-value= "${project}"/> <resources default-value= "${projecT.resources} "/> <session default-value=" ${session} "/> <supportmultilinefiltering default-value=" false " >${maven.resources.supportMultiLineFiltering}</supportMultiLineFiltering> <usebuildfilters Default-value= "true"/> <usedefaultdelimiters default-value= "true"/></configuration>[debug]------- ----------------------------------------------------------------[DEBUG] goal:org.apache.maven.plugins:maven-com Piler-plugin:3.1:compile (Default-compile) [DEBUG] style:regular[debug] Configuration: <?xml version= "1.0" Enco ding= "UTF-8"?><configuration> <basedir default-value= "${basedir}"/> <builddirectory Default-value= "${project.build.directory}"/> <classpathelements default-value= "${ project.compileclasspathelements} "/> <compilesourceroots default-value=" ${project.compilesourceroots} "/ > <compilerid default-value= "Javac" >${maven.compiler.compilerId}</compilerId> < CompilerreusestrategyDefault-value= "${reusecreated}" >${maven.compiler.compilerReuseStrategy}</compilerReuseStrategy> < Compilerversion>${maven.compiler.compilerversion}</compilerversion> <debug default-value= "true" >$ {maven.compiler.debug}</debug> <debuglevel>${maven.compiler.debuglevel}</debuglevel> < Encoding default-value= "${project.build.sourceencoding}" >${encoding}</encoding> <executable>${ Maven.compiler.executable}</executable> <failonerror default-value= "true" >${ Maven.compiler.failonerror}</failonerror> <forcejavaccompileruse default-value= "false" >${ Maven.compiler.forcejavaccompileruse}</forcejavaccompileruse> <fork default-value= "false" >${ maven.compiler.fork}</fork> <generatedsourcesdirectory default-value= "${project.build.directory}/ Generated-sources/annotations "/> <maxmem>${maven.compiler.maxmem}</maxmem> <meminitial>${ Maven.compiler.meminitial}</meminitial&gT <mojoExecution>${mojoExecution}</mojoExecution> <optimize default-value= "false" >${ maven.compiler.optimize}</optimize> <outputdirectory default-value= "${project.build.outputdirectory}"/ > <projectartifact default-value= "${project.artifact}"/> <showdeprecation default-value= "false" >${ Maven.compiler.showdeprecation}</showdeprecation> <showwarnings default-value= "false" >${ Maven.compiler.showwarnings}</showwarnings> <skipMain>${maven.main.skip}</skipMain> < Skipmultithreadwarning default-value= "false" >${maven.compiler.skipmultithreadwarning}</ skipmultithreadwarning> <source default-value= "1.5" >1.7</source> <stalemillis default-value= "0" >${lastModGranularityMs}</staleMillis> <target default-value= "1.5" >1.7</target> < Useincrementalcompilation default-value= "true" >${maven.compiler.useincrementalcompilation}</ Useincrementalcompilation> <verbose defAult-value= "false" >${maven.compiler.verbose}</verbose> <mavensession default-value= "${session}"/> <session default-value= "${session}"/></configuration>[debug]--------------------------------------- --------------------------------[DEBUG] Goal:org.codehaus.mojo:native2ascii-maven-plugin:1.0-beta-1:native2asci I (NATIVE2ASCII-UTF8) [DEBUG] style:regular[debug] Configuration: <?xml version= "1.0" encoding= "UTF-8"?>< configuration> <encoding default-value= "${project.build.sourceencoding}" >UTF8</encoding> < Includes> <include>ApplicationResources_zh*.properties</include> <include>displaytag_zh*. properties</include> </includes> <tempdir default-value= "${project.build.directory}"/> < Workdir default-value= "${project.build.outputdirectory}"/></configuration>[debug]--------------------- --------------------------------------------------[DEBUG] Goal:org.apaChe.maven.plugins:maven-resources-plugin:2.6:testresources (default-testresources) [DEBUG] style:regular[debug] Co Nfiguration: <?xml version= "1.0" encoding= "UTF-8"?><configuration> <buildfilters default-value= "${ Project.build.filters} "/> <encoding default-value=" ${project.build.sourceencoding} ">${encoding}</ Encoding> <escapeString>${maven.resources.escapeString}</escapeString> <escapewindowspaths Default-value= "true" >${maven.resources.escapeWindowsPaths}</escapeWindowsPaths> <includeemptydirs Default-value= "false" >${maven.resources.includeEmptyDirs}</includeEmptyDirs> <outputdirectory Default-value= "${project.build.testoutputdirectory}"/> <overwrite default-value= "false" >${ maven.resources.overwrite}</overwrite> <project default-value= "${project}"/> <resources Default-value= "${project.testresources}"/> <session default-value= "${session}"/> <skip>${ Maven.test.skiP}</skip> <supportmultilinefiltering default-value= "false" >${ maven.resources.supportmultilinefiltering}</supportmultilinefiltering> <useBuildFilters default-value= " True "/> <usedefaultdelimiters default-value=" true "/></configuration>[debug]---init fork of Com.github:demo:1.0-snapshot for ORG.CODEHAUS.MOJO:HIBERNATE3-MAVEN-PLUGIN:2.2:HBM2DDL (default)---[DEBUG] Dependencies (collect): [][debug] Dependencies (resolve): [][debug]------------------------------------------------ -----------------------[DEBUG] Goal:org.apache.maven.plugins:maven-resources-plugin:2.6:resources (Default-resou RCEs) [DEBUG] style:regular[debug] Configuration: <?xml version= "1.0" encoding= "UTF-8"? ><configuration&gt  ; <buildfilters default-value= "${project.build.filters}"/> <encoding default-value= "${ project.build.sourceEncoding} ">${encoding}</encoding> <escapestring>${ Maven.resources.escapestring}</escapestring> &Lt;escapewindowspaths default-value= "true" >${maven.resources.escapeWindowsPaths}</escapeWindowsPaths> <includeemptydirs default-value= "false" >${maven.resources.includeEmptyDirs}</includeEmptyDirs> < OutputDirectory default-value= "${project.build.outputdirectory}"/> <overwrite default-value= "false" >${ maven.resources.overwrite}</overwrite> <project default-value= "${project}"/> <resources Default-value= "${project.resources}"/> <session default-value= "${session}"/> < Supportmultilinefiltering default-value= "false" >${maven.resources.supportmultilinefiltering}</ Supportmultilinefiltering> <usebuildfilters default-value= "true"/> <usedefaultdelimiters default-value = "true"/></configuration>[debug]---exit fork of com.github:demo:1.0-snapshot for Org.codehaus.mojo: HIBERNATE3-MAVEN-PLUGIN:2.2:HBM2DDL (default)---

The interesting part of this log is that resources:resources was executed two times. The first time is before Native2ascii:native2ascii, and the second time is called again after Native2ascii:native2ascii executes HBM2DDL. To accurately understand the order of execution of Resources:resources and Native2ascii:native2ascii, we find the periodic description of their default bindings from their respective documents:


Resources:resources-Process-resources

Native2ascii:native2ascii-Process-classes


The default life cycle for Maven is as follows:

<phases> <phase>validate</phase> <phase>initialize</phase> <phase> Generate-sources</phase> <phase>process-sources</phase> <phase>generate-resources</ phase> <phase>process-resources</phase> <phase>compile</phase> <phase> Process-classes</phase> <phase>generate-test-sources</phase> <phase>process-test-sources </phase> <phase>generate-test-resources</phase> <phase>process-test-resources</phase > <phase>test-compile</phase> <phase>process-test-classes</phase> <phase>test </phase> <phase>prepare-package</phase> <phase>package</phase> <phase> Pre-integration-test</phase> <phase>integration-test</phase> <phase> Post-integration-test</phase> <phase>verify</phase> <phase>install</phase> < Phase>deploy</phAse></phases> 

According to normal logic, resources:resources will place all specified resource files in the target directory before native2ascii:native2ascii, and then Native2ascii : Native2ascii Follow-up, the specified file transcoding, this is a very reasonable way to handle, and our problem is in the second abnormal call to Resources:resources, which led to the previously transcoded file and was overwritten by the file without transcoding! From the log, the reason for the second execution of resources:resources should be the execution of HBM2DDL triggered after entering the process-test-resources phase, In other words, HBM2DDL is a certain action to invoke the Resources:resources, as to the specific details, is the bug or compatibility with Maven3, here we no longer delve into, but the solution has become very clear, that is the approach mentioned earlier.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.