Book on the Back: AppFuse 3 common problems and solutions, a new problem: garbled! Under the 3.0.0 version number, after running the MVN appfuse:full-source command and using MVN Jetty:run to start the project, garbled characters appear on the page. What I'm saying is that this garbled question is 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 and stare at the <executions/> part of it, i.e. not running HBM2DDL in the process-test-resources phase.
(Assuming you need to export the schema to the database, you can manually run MVN hibernate3:hbm2ddl, which is more in line with the actual development needs). Yes, it doesn't seem to matter. But the problem is out here! Below we fall back to the point where the problem occurs and we step through it. For some of the details beyond the list, you can refer to: Considerations for building projects based on Appfuse 2.1 High Speed This article is from the source: http://blog.csdn.net/bluishglc/article/details/38640715 No matter what form of reprint, otherwise will entrust CSDN official maintenance rights!
First, look at the Chinese properties file under the compiled output folder target/classes. Can you make sure that the file itself is not transcoded and that the Native2ascii plugin is not working properly? Pass the check. The problem is not found on the Native2ascii-maven-plugin configuration. Using MVN clean package-x to view the log information in the MAVEN runtime, 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-compiler-plugin:3.1:comp Ile (Default-compile) [DEBUG] style:regular[debug] Configuration: <?
XML version= "1.0" encoding= "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> < Compilerreusestrategy default-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> <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:native2 ASCII (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[debu G] 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.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> <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]---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 run two times. The first time was before Native2ascii:native2ascii, and the second time was once again when the HBM2DDL was run after the NATIVE2ASCII:NATIVE2ASCII was run. To accurately understand the order in which Resources:resources and Native2ascii:native2ascii are run, 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, the resources:resources will be placed in the target folder after the filter processing of all the specified resource files prior to native2ascii:native2ascii. After Native2ascii:native2ascii follow up. Transcode the specified file. This is a very reasonable approach, and our problem is now the second abnormal call to Resources:resources, which led to the previously transcoded files are overwritten by non-transcoded files. From the log, the reason for the second run of Resources:resources should be to run HBM2DDL triggered after entering the process-test-resources phase. In other words, a hbm2ddl action called the Resources:resources, as detailed details. is a bug or a compatibility issue with MAVEN3, here we no longer delve into, but the solution has become very clear, that is the approach mentioned earlier.
Garbled problem with AppFuse 3