我有一个使用maven管理依赖项的Cordova项目,当我在命令行中执行“cordova build”时,它找不到导致编译失败的maven依赖项。
如何在Cordova命令行构建中包含maven依赖项?感谢任何指针。谢谢
答案 0 :(得分:0)
您可以使用.gradle
文件CordovaLib/cordova.gradle
,CordovaLib/build.gradle
通过gradle
执行此操作,但是为了在maven中执行此操作,我发现了一种有效的方法。
git clone http://github.com/my_maven_repo
cd
进入pom.xml
并查找<build><plugins>
文件
转到<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>fully.qualified.MainClass</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>fully.qualified.MainClass</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id><phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
标记,并使用现有插件添加以下2:
mvn clean compile assembly:single
现在,转到终端并输入命令JAR
。
您将在/packageName/target/
中看到带有依赖关系的新JAR
作为已编译的+ myradiogroup
- sling:resourceType = "granite/ui/components/foundation/form/radiogroup"
+ items
+ option1
- sling:resourceType = "granite/ui/components/foundation/form/radio"
- name = "browser"
- value = "ie"
- text = "Internet Explorer"
+ option2
- sling:resourceType = "granite/ui/components/foundation/form/radio"
- name = "browser"
- value = "chrome"
- text = "Chrome"
+ option3
- sling:resourceType = "granite/ui/components/foundation/form/radio"
- name = "browser"
- value = "firefox"
- text = "Firefox"
- 现在您只需将其导入Cordova或任何Android / Java项目。
希望有所帮助