问题
I was looking at What is the correct Eclipse setup for JHipster? and decided I have a similar question with enough differences to warrant posting a separate question.
I am able to build and run a jhipster app using yo that seems to run ok (I choose defaults with the exception of the database - which is MySQL in both local and prod, plus websockets, and "y" to the CSS package).
I am then able to import the maven project into STS 3.5 and run it ok from there as well.
The only thing I'd like to figure out is why all of this seems to work even when there are so many DTD, JSON, XML and even one Java error reporting in STS for this project? Should I choose to ignore some of these validations in my STS project, or are these legitimate jhipster bugs?
Errors include:
Description Resource Path Location Type
APT Problems (1 item)
JSR250: CommonAnnotations for Java, 2.5: @PostConstruct methods must not throw checked exceptions. Application.java /pdbClient/src/main/java/com/staples/pdbc line 35 Annotation Problem
DTD Problem (2 items)
The declaration for the entity "ContentType" must end with '>'. strict.dtd /pdbClient/node_modules/grunt-contrib-imagemin/node_modules/imagemin/node_modules/imagemin-svgo/node_modules/svgo/node_modules/sax/examples line 81 DTD Problem . . .
JSON Problem (23 items)
Object is not closed. bower.json /pdbClient/node_modules/bower/node_modules/bower-json/test/pkg-bower-json-malformed line 1 JSON Problem
Unexpected token '/'. Expected '}', ','. broken.json /pdbClient/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/npmconf/node_modules/config-chain/test line 10 JSON Problem (etc.). . .
Unexpected token '<%'. Expected a string or '}'. _bower.json /pdbClient/node_modules/generator-jhipster/app/templates line 4 JSON Problem (etc.). . .
XML Problem (30 items)
The content of elements must consist of well-formed character data or markup. _pom.xml /pdbClient/node_modules/generator-jhipster/app/templates line 4 XML Problem
The element type "slurm" must be terminated by the matching end-tag "". big-not-pretty.xml /pdbClient/node_modules/grunt-contrib-imagemin/node_modules/imagemin/node_modules/imagemin-svgo/node_modules/svgo/node_modules/sax/examples line 7 XML Problem (etc.). . .
The string "--" is not permitted within comments. test.xml /pdbClient/node_modules/grunt-contrib-imagemin/node_modules/imagemin/node_modules/imagemin-svgo/node_modules/svgo/node_modules/sax/examples line 10 XML Problem (etc.). . .
The value following "version" in the XML declaration must be a quoted string. fries.xml /pdbClient/node_modules/generator-jhipster/node_modules/cheerio/node_modules/CSSselect/test/sizzle/data line 1 XML Problem (etc.). . .
The value of attribute "defaultValueDate" associated with an element type "column" must not contain the '<' character. _db-changelog-001.xml /pdbClient/node_modules/generator-jhipster/app/templates/src/main/resources/config/liquibase/changelog line 28 XML Problem
The value of attribute "name" associated with an element type "cache" must not contain the '<' character. _ehcache.xml /pdbClient/node_modules/generator-jhipster/app/templates/src/main/resources line 20 XML Problem (etc.). . .
回答1:
You should not validate your node_modules directory. It's not part of the generated application (it's excluded in .gitignore), and as it contains templates to create the application, it contains some non-valid XML and JSON files. Anyway, a true hipster wouldn't work with Eclipse :-)
回答2:
Here are more details on how to exclude unwanted folders inside Eclipse:
To exclude the ‘node_modules’ folder in Eclipse (based on Eclipse 3.6.2)
- right click on Project -> Resource -> Resource Filters
- You should then select: Exclude all, Applies to folders, Name matches node_modules
- Press ok and you should be good to go.
There are also 2 folders inside src/main/webapp that should be excluded: “bower_components” and “scripts”
To do so:
- right click on Project -> Javascript -> Include path
- You can then click on the “source” tab and select your_project/src/main/webapp
- You can then select “Excluded: (None) -> Edit -> Add multiple
- You can select “bower_components” and “scripts” and click “ok”.
来源:https://stackoverflow.com/questions/25894363/why-so-many-validation-errors-on-a-jhipster-built-app-when-importing-into-sts