处理jQuery+;带maven的jQuery UI资源
这是我当前的文件夹结构:处理jQuery+;带maven的jQuery UI资源,jquery,maven,jquery-ui,exec-maven-plugin,maven-antrun-plugin,Jquery,Maven,Jquery Ui,Exec Maven Plugin,Maven Antrun Plugin,这是我当前的文件夹结构: . |-- pom.xml `-- src `-- main |-- java | `-- ... |-- resources | `-- messages | `-- messages.properties | `-- ... | `-- properties |
.
|-- pom.xml
`-- src
`-- main
|-- java
| `-- ...
|-- resources
| `-- messages
| `-- messages.properties
| `-- ...
| `-- properties
| `-- hibernate.properties
| `-- jawr.properties
| `-- ...
| `-- log4j.xml
| `-- tiles.xml
`-- webapp
|-- resources
| `-- css
| `-- ...
| `-- images
| `-- ...
| `-- js
| `-- main.js
|-- WEB-INF
| `-- context
| `-- application.xml
| `-- hibernate.xml
| `-- security.xml
| `-- servlet.xml
| `-- views
| `-- ...
| `-- redirect.jsp
| `-- web.xml
如您所见,在src/main/webapp/resources
中有js
。
我正在使用scm插件检查这些GitHub存储库:
签出后,我需要使用他们的构建机制来连接和缩小并移动target/jquery/dist/jquery.min.js
,target/jquery ui/build/dist/jquery ui.min.js
,jqueryui/build/dist/jquery-ui-1.9pre/ui/minified/i18n/jquery-ui-i18n.min.js
totarget/myproject-1.0-SNAPSHOT/resources/js
下面是我的pom.xml的必要片段:
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-scm-plugin</artifactId>
<executions>
<execution>
<id>checkout-jquery</id>
<phase>compile</phase>
<goals>
<goal>checkout</goal>
</goals>
<configuration>
<connectionUrl>scm:git:git://github.com/jquery/jquery.git</connectionUrl>
<checkoutDirectory>${project.build.directory}/jquery</checkoutDirectory>
</configuration>
</execution>
<execution>
<id>checkout-jquery-ui</id>
<phase>compile</phase>
<goals>
<goal>checkout</goal>
</goals>
<configuration>
<connectionUrl>scm:git:git://github.com/jquery/jquery-ui.git</connectionUrl>
<checkoutDirectory>${project.build.directory}/jquery-ui</checkoutDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>make</executable>
<workingDirectory>${project.build.directory}/jquery</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<ant antfile="build.xml" dir="${project.build.directory}/jquery-ui/build" />
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
脚本在错误的目录中查找(/home/danny/myproject/dist/jquery-ui-1.9pre/ui/minified/jquery ui.min.js
而不是/home/danny/myproject/target/jquery ui/build/dist/jquery-ui-1.9pre/ui/minified/jquery ui.min.js
)
编辑:问题是:minify-js.sh获取了错误的第二个参数($2)。
将此添加到modify-js.sh:echo“test:$1->$2”
将导致:test:/home/danny/myproject/target/jquery ui/build/dist/jquery-ui-1.9pre/ui/jquery-ui.js->/home/danny/myproject/dist/jquery-ui-1.9pre/ui/minified/jquery ui.min.js
但为什么
EDIT2:
但是现在我需要知道如何在war:excluded
之后将缩小的jquery、jqueryui和jquery-ui-i18n js文件移动到target/myproject-1.0-SNAPSHOT/resources/js
这里最好的方法是什么?我想为您的“maven antrun插件”添加另一个执行,该插件运行ant“move”命令并移动您需要的一切 坦率地说,您必须试验您希望将此绑定到哪个阶段。我猜war:excluded正在“打包”阶段运行。如果是这样的话,因为maven在包测试和集成测试之间没有一个步骤,所以您可以:
我会给你的“maven antrun插件”添加另一个执行,它运行一个ant“move”命令并移动你需要的一切 坦率地说,您必须试验您希望将此绑定到哪个阶段。我猜war:excluded正在“打包”阶段运行。如果是这样的话,因为maven在包测试和集成测试之间没有一个步骤,所以您可以:
minify:
[echo] Building minified
[mkdir] Created dir: /home/danny/myproject/target/jquery-ui/build/dist/jquery-ui-1.9pre/ui/minified
[mkdir] Created dir: /home/danny/myproject/target/jquery-ui/build/dist/jquery-ui-1.9pre/ui/minified/i18n
[mkdir] Created dir: /home/danny/myproject/target/jquery-ui/build/dist/jquery-ui-1.9pre/themes/base/minified
[apply] build/minify-js.sh: Line 3: /home/danny/myproject/dist/jquery-ui-1.9pre/ui/minified/jquery-ui.min.js: File or folder not found
[apply] Result: 1
...