本文介绍了使用maven在Jar中打包javascript文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Maven 2的新手,并尝试使用maven将一组javascript(如Dojo库)打包到jar lib中(没有java类,只有扩展名为.js的文件)。所以我想我应该尝试 maven-assembly-plugin
,这里有一些顾虑:
I am a newbie on Maven 2 and trying to pack a set of javascript (like Dojo library) into a jar lib using maven(no java class but only files with .js extension). So I guess I should try maven-assembly-plugin
, here are a few concerns:
- 没有
mainClass
但我怎么还有MANIEST.MF? - 我可以使用
jar-with-dependencies
as< descriptorRefs>
如果我不打算更改jar中的文件层次结构? - 可能这是一个愚蠢的问题,但我应该在哪里放
pom.xml
(在javascript lib文件夹或javascript lib的同一级别)文件夹)?
- There is no
mainClass
but how can I still have a MANIEST.MF? - Can I use
jar-with-dependencies
as<descriptorRefs>
if I don't plan to change the file hierarchy in the jar? - May be this is a silly question but where shall I put the
pom.xml
(within the javascript lib folder or the same level of the javascript lib folder)?
请提前通知我。
推荐答案
如果你使用像这样的标准Maven项目布局:
If you use a standard Maven project layout like so:
project
|-src
. |-main
. |-resources
. |-<JS files here>
|-pom.xml
然后将使用JAR包装的普通POM文件您的Javascript文件到输出JAR。
Then a normal POM file that uses the JAR packaging will place your Javascript files into the output JAR.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.foo.bar</groupId>
<artifactId>foo</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Foo</name>
</project>
这将保留 src / main / resources下的任何文件夹结构
。
这篇关于使用maven在Jar中打包javascript文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!