我们的 Android 项目是一个 monorepo,包含几个应用程序模块,甚至更多的库模块。其中一个库应该可供其他开发人员访问,因此我们决定将其部署在 MavenCentral 上。我们称之为图书馆吧L。然而,该库还包含 monorepo 内对另一个模块的依赖关系(我们称之为 module m)。为了测试L其他开发人员是否可以正确访问该库,我们创建了一个演示Android项目。但是,当尝试包含发布库的依赖项时L,通常一切都很好,只是m在演示 Android 项目中无法解析该模块。
可以理解的是,该模块m无法解析,因为它既不能在 MavenCentral 上使用,也不能作为 AAR 文件使用。我们无法发布该模块m,因为它不应该可供其他人获取,但将其作为 AAR 文件包含也不起作用。终端抛出错误:
构建 AAR 时不支持直接本地 .aar 文件依赖项。生成的 AAR 将被破坏,因为任何本地 .aar 文件依赖项中的类和 Android 资源都不会打包在生成的 AAR 中。在这种情况下,以前版本的 Android Gradle 插件也会产生损坏的 AAR(尽管不会抛出此错误)。
所以问题来了 - 一个包含无法公开的子模块的项目如何发布到存储库mavenCentral?
我很感激任何有关这方面的帮助,因为我是一个noobie w/gradle.我有一个包含多个buildTypes的构建脚本,但是其中一个构建脚本的设置会覆盖其他构建脚本.
这是我的build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.2'
}
}
apply plugin: 'android'
dependencies {
compile project(':facebook-android-sdk-3.0.1:facebook')
compile project(':google-play-services_lib')
compile project(':nineoldandroids')
compile project(':SlidingMenu-master:library')
compile project(':ViewPagerIndicator')
compile project(':volley')
compile project(':windowed-seek-bar')
compile files('compile-libs/androidannotations-2.7.1.jar', 'libs/Flurry_3.2.1.jar', 'libs/google-play-services.jar', 'libs/gson-2.2.4.jar', 'libs/picasso-1.1.1.jar', 'libs/crittercism_v3_0_11_sdkonly.jar', 'libs/gcm.jar', 'libs/apphance-library.jar')
}
android {
buildToolsVersion "17.0"
compileSdkVersion 17
signingConfigs {
debug {
storeFile file('keystores/debug.keystore')
}
release {
storeFile file('keystores/release.keystore')
storePassword "***"
keyAlias "***"
keyPassword "***"
}
}
buildTypes {
debug {
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs …Run Code Online (Sandbox Code Playgroud) 我有一个maven项目,有一个主项目A和模块B和C。子项目继承自A的pom。
A
|
|----B
| |----pom.xml
|
|----C
| |----pom.xml
|
|----pom.xml
Run Code Online (Sandbox Code Playgroud)
它已经为所有模块构建了 jar。有没有办法将依赖项包含在这些 jar 中?例如,我得到B-1.0-with-dependencies.jar并且C-1.0-with-dependencies.jar?我尝试过设置
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
在父 pom 中,但它似乎没有做任何事情:构建成功,但我得到常规的、无依赖项的 jar。
我想避免在每个子 pom 中放入一些东西,因为实际上我有两个以上的模块。我确信有某种方法可以做到这一点,但似乎无法从 Maven 文档中解决。谢谢!
我正在使用maven插件minify-maven-plugin来缩小我的前端项目.当我将dos框移到前端项目并执行mvn clean install时,这工作正常,但是当我mvn clean install在我的reactor项目中的主pom中执行时,我得到以下异常:
无法执行目标com.samaxes.maven:minify-maven-plugin:1.7.4:minify(default-minify)项目my.project-frontend:目标com.samaxes.maven的执行default-minify:minify-maven-插件:1.7.4:缩小失败:basedir ./src/main/resources/public/app/.不存在
有谁知道该怎么做才能使这项工作?
以下有关的插件配置:
<!-- minify plugin -->
<plugin>
<groupId>com.samaxes.maven</groupId>
<artifactId>minify-maven-plugin</artifactId>
<version>1.7.4</version>
<executions>
<execution>
<id>default-minify</id>
<phase>prepare-package</phase><!-- When omitted defaults to 'process-resources' -->
<configuration>
<charset>UTF-8</charset>
<skipMerge>true</skipMerge>
<nosuffix>true</nosuffix>
<closureCompilationLevel>WHITESPACE_ONLY</closureCompilationLevel>
<webappSourceDir>src/main/resources/public/app</webappSourceDir>
<webappTargetDir>${project.build.outputDirectory}/public/app</webappTargetDir>
<cssSourceDir>./</cssSourceDir>
<cssSourceIncludes>
<cssSourceInclude>**/*.css</cssSourceInclude>
</cssSourceIncludes>
<jsSourceDir>./</jsSourceDir>
<jsSourceIncludes>
<jsSourceInclude>**/*.js</jsSourceInclude>
</jsSourceIncludes>
<jsEngine>CLOSURE</jsEngine>
</configuration>
<goals>
<goal>minify</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- minify plugin end -->
Run Code Online (Sandbox Code Playgroud) 我有一个多模块 spring-boot 项目,我想将其部署在Openshift上,我也在那里安装了 Jenkins。源代码托管在 Github 上。每个模块都包含一场战争,以便拥有微服务结构:
<modules>
<module>xyz-common</module>
<module>xyz-data-services</module> <!--a REST service to interact with mongodb-->
<module>xyz-batch-importer</module> <!--a service to import files into Mongo-->
<module>xyz-frontend</module>
</modules>
Run Code Online (Sandbox Code Playgroud)
我找到了部署单个 spring-boot 应用程序的教程,但我无法弄清楚这如何应用于多模块 Maven 项目。
如果我有这样的目录结构:
\n\nsrc\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Commands.elm\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Decoders.elm\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Main.elm\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Messages.elm\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Models.elm\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Page\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Cats\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Main.elm\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Style.elm\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 ...\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Pieces\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Main.elm\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Style.elm\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 ...\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Players\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Main.elm\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Style.elm\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 ...\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Routing.elm\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Style\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Index.elm\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 MainCss.elm\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Main.elm\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Update.elm\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 View.elm\nRun Code Online (Sandbox Code Playgroud)\n\n我找到了一些说明如何从目录导入模块的示例,但找不到有关如何从子目录导入模块的示例。\n例如,如何Page/Cats/Main.elm …
我有我的多模块 Spring Boot 项目。我将服务、实体和存储库移至核心模块,而在 war 模块中,我只有控制器。
这里有什么问题?如果我在没有 JPA 的情况下使用,那么我的核心模块工作正常。如果我在核心模块中添加 JPA 依赖项并在我的服务中注入存储库,那么我会收到各种错误,例如存储库的 noclassdefinitionfound、没有服务类型的合格 bean 等。
如何使这个应用程序工作?
父 pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<name>appx</name>
<modelVersion>4.0.0</modelVersion>
<groupId>org.imsx</groupId>
<artifactId>appx</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>core</module>
<module>webx</module>
<module>imsx</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<version.wildfly.maven.plugin>1.0.2.Final</version.wildfly.maven.plugin>
<version.jboss.bom>8.2.1.Final</version.jboss.bom>
<version.wildfly>14.0.1.Final</version.wildfly>
<version.compiler.plugin>3.8.0</version.compiler.plugin>
<version.ear.plugin>3.0.1</version.ear.plugin>
<version.jar.plugin>3.1.1</version.jar.plugin>
<version.war.plugin>3.2.2</version.war.plugin>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
<version>${version.compiler.plugin}</version>
</plugin>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>${version.wildfly.maven.plugin}</version>
<inherited>true</inherited>
<configuration>
<skip>true</skip> …Run Code Online (Sandbox Code Playgroud) 我有一个Maven多模块项目,并且在此版本中需要两个不同的父POM。第一个是项目中大多数模块的真正父POM,但是一个模块是演示项目,它使用完全不同的项目的父POM(因为这是演示如何使用我的项目为第二个项目生成代码)。
构建工作,但我得到警告:
[WARNING]
[WARNING] Some problems were encountered while building the effective model for my_project:my_project.demo:jar:5.0.0-SNAPSHOT
[WARNING] 'parent.relativePath' points at my_project:parent instead of other_project:parent, please verify your project structure @ line 5, column 10
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
Run Code Online (Sandbox Code Playgroud)
由于other_project实际上并不是我构建的模块,因此它可以在任何地方。这意味着我不能给出相对路径。
如何解决此警告?
我有一个Maven项目https://github.com/paulvi/MavenMultiModule1
用root pom.xml作为
<modules>
<module>MavenModule1</module>
<module>MavenModule2</module>
</modules>
<properties>
</properties>
<profiles>
<profile>
<id>p1</id>
<modules>
<module>MavenModule1</module>
</modules>
</profile>
<profile>
<id>p2</id>
<modules>
<module>MavenModule2</module>
</modules>
</profile>
</profiles>
Run Code Online (Sandbox Code Playgroud)
我希望能够单独构建子系统,
例如mvn package -P p1和mvn package -P p2
两个配置文件都可见,但无法通过-P开关激活
mvn help:all-profiles -P p1
Run Code Online (Sandbox Code Playgroud)
这里缺少什么来激活配置文件或什么是更好的方法来构建子系统?
我在maven中有一个多模块项目,其中一些模块依赖于其他模块.现在,充当依赖项的模块具有一些依赖项,这些依赖项已经在依赖模块的pom中列出.
有没有快速的方法来识别这样的重复依赖项并从依赖模块的pom中删除它们?
multi-module ×10
maven ×5
java ×4
android ×2
gradle ×2
spring-boot ×2
aar ×1
build ×1
dependencies ×1
elm ×1
import ×1
jar ×1
jenkins ×1
maven-2 ×1
minify ×1
openshift ×1
parent-pom ×1
python ×1