admin管理员组文章数量:1356709
I want to create a single page webapp front-end using Maven.
My goal here is quite simple: I have some dependencies expressed as webjars and I want to be able to reference them from my HTML page.
I also want to have them served through a simple HTTP server.
What is the best way to do that ?
I want to create a single page webapp front-end using Maven.
My goal here is quite simple: I have some dependencies expressed as webjars and I want to be able to reference them from my HTML page.
I also want to have them served through a simple HTTP server.
What is the best way to do that ?
Share Improve this question edited May 28, 2017 at 18:46 Badacadabra 8,5277 gold badges31 silver badges54 bronze badges asked Mar 2, 2015 at 10:29 RiduidelRiduidel 22.3k15 gold badges90 silver badges191 bronze badges 1- Did you have success setting up the project, if not i would try to create an example. – Martin Baumgartner Commented Mar 2, 2015 at 15:26
1 Answer
Reset to default 5I didn't use webjars yet, but it looks like a nice project which i had to take a closer look into it. I like it and will port my hobby-project to use it :)
Take a look into the documentation to the servlet 3 section, it's really straight forward.
If you are not familiar with maven, here the necessary part:
Create a maven project
mvn archetype:generate -DgroupId=.domain.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
You are done!
As a last step, add maven-dependency-plugin to your pom.xml, and use the unpack-dependencies goal to unpack all the jar resources to a folder. The web-build folder can be deployed to your http server.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>resource-dependencies</id>
<phase>process-resources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>org.webjars</includeArtifactIds>
<outputDirectory>${project.build.directory}/web-build</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
Unfortunatly, I haven't done this yet, but this answer should contain all the instructions to build your project. And also, you should be able to host the jar on a servlet 3 application server.
I've created an example project and published it on my github account: https://github./baumgartner/maven-webjars-plain-webproject
本文标签: How to create a pure JavaScript project using MavenStack Overflow
版权声明:本文标题:How to create a pure JavaScript project using Maven? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744035792a2579746.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论