Author | Message |
---|---|
cysun
Posts: 2935
|
Posted 08:13 Oct 11, 2011 |
1. Create a Maven project with the archetype maven-archetype-webapp. 2. Change web.xml to the following
Change the id attribute of <web-app> and <display-name> to match your project, and feel free to add other things like <welcome-file-list> to web.xml. 3. Add the following to pom.xml (right after <finalName>):
4. Add the following dependencies:
5. Add a folder src/main/java 6. Right click on the project and select Maven -> Update Project Configuration Anyone who create and publish an archetype for this will receive extra credit for CS520. |
aligh1979
Posts: 121
|
Posted 14:18 Oct 11, 2011 |
I just finished creating a maven project of homework 2 successfully . how we can submit this for an extra credit?
there is one more thing that I can not understand , when we check out the maven project "review" from the repository , the servlet and model java source files (and so it is the class file structure folder) are under folder cs520 / review , and wen we run the project we see this path in the address bar , localhost:8080/cs520-review/index.html at first I thought the address bar is this way because of the "final name " in POM.xml file which is "cs520-review" but after changing the final name in POM , realized that there is no change and it is still the same in address bar , then I thought that maven automatically read the structure and put a dash (-) between folder names for Address. but when I created my own maven project for homework and put the servlet , model under one extra folder named "Rubrics" , realized that , in the address bar it refers to something like "localhost:8080/<name of the project>/index.html" eg. localhost:8080/hm2/index.html regardless of the final name in POM.XMl . even if I removed that intermediate folder ("Rubrics") , it will still point out to the same Address path . So here is the confusion , what determines the address path and where (what file or setting) it is determined in ?
Thanks upfront |
cysun
Posts: 2935
|
Posted 15:13 Oct 11, 2011 |
1. You must create and publish an archetype. Creating a project doesn't earn you any extra credit. 2. Eclipse use the project name as the context name, and for a Maven project the project name is the ArtifactId, not <finalName> or package name. |
aligh1979
Posts: 121
|
Posted 16:11 Oct 11, 2011 |
Isn't artifact Id saved in POM.xml ? I just changed that to something else , still the Address bar path is the same |
cysun
Posts: 2935
|
Posted 16:15 Oct 11, 2011 |
Eclipse chooses the project name when the project is created/checked out from repository. Changing ArtifactId after that will not change the project name in Eclipse. If you want to change project name, right click on the project and select Refactor -> Rename. |
aaronyen
Posts: 29
|
Posted 11:08 Oct 13, 2011 |
Dr. Sun, How do I provide the proof that I've published an archetype? Do I deploy it for all Maven users? |
cysun
Posts: 2935
|
Posted 13:40 Oct 13, 2011 |
Please check out this article on how to create and publish an archetype. You can use CS3 for publishing your archetype. Put it under the public_html folder of your home directory, and you can access it through the URL http://cs3.calstatela.edu/<account_name>. BTW, the extra credit is for one person only. Whoever publishes first gets the extra credit. |