- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我们目前正在评估为我们的 java 开发建立一个内部公司关系存储库。
很遗憾,还有一些问题没有得到解答,但也许您可以提供帮助。
公司内部所有项目的父 pom 似乎是最佳实践。不清楚的是除了 <organization>
之外,这个 pom 应该包含什么部分。
同时指定 <distributionManagement>
是否是最佳实践?在这个 pom 里面?如果是,它应该包含什么?如果我们想引用公司关系(<site>
、<repository>
、<snapshotRepository>
),它应该是什么样子?
如何处理这样一个事实(根据 sonatype)每个项目都有自己的存储库而不需要在每个 pom 中指定 nexus 根路径是最佳实践?
我们还应该指定 <repositories>
吗?和 <pluginRepositories>
那里的部分(引用我们的内部联系)?
此外,我们希望基本上每个项目都可以部署自己的站点,我们能否在父 pom 中也指定这一点?如果是,站点插件配置应该是什么样的?
最好是有人可以提供一个完整的、示例性的公司 pom,可以与内部 nexus 存储库一起使用。
或者将这些东西放在 settings.xml
中会更好吗?不将项目绑定(bind)到某个存储库?但据我所知<distributionManagement>
不能在settings.xml里面指定?如果某天 nexus url 发生变化,这将是一项繁琐的更新工作吗?
尽管我尝试阅读很多相关内容,但我对这整件事真的很困惑。
提前致谢!
感谢Michael-O下面的答案我有我需要的信息。
<repositories>
和 <pluginRepositories>
标签属于 settings.xml
.这是指定nexus仓库的地方用于“下载”(可选地包括使用 <servers>
<distributionManagement>
属于企业基地pom,为发布和快照引用一个基本的 Nexus 存储库。这是为“上传”(部署)指定 nexus 存储库的地方。如果需要子存储库(用于逻辑分组项目),它们在项目内指定 pom.xml
因此覆盖公司 pom 中的那些。为了简化这一点并仅将基本的联系 url 保留在公司 pom 中(注意 url 更改),在 <distributionManagement>
中指定存储库可能是有用的/可能的。通过以下方式:
<repository>
<id>company-repository</id>
<name>Internal Releases</name>
<url>http://my.nexus.repo/releases/${subRepositoryId}-releases</url>
</repository>
可以在 this post 中找到示例性的公司 pom
企业 pom 可能包含类似这样的内容:
<project>
....
<properties>
<repository.group>common</repository.group>
<repository.url.base>http://my.nexus:port/nexus/content</repository.url.base>
<repository.url.repositories>${repository.url.base}/repositories</repository.url.repositories>
<repository.url.sites>${repository.url.base}/sites</repository.url.sites>
</properties>
<distributionManagement>
<repository>
<id>company-repository</id>
<name>Internal Releases</name>
<url>${repository.url.repositories}/${repository.group}-releases</url>
</repository>
<snapshotRepository>
<id>company-repository</id>
<name>Internal Snapshots</name>
<url>${repository.url.repositories}/${repository.group}-snapshots</url>
</snapshotRepository>
</distributionManagement>
....
</project>
项目pom与此类似:
<project>
...
<properties>
<repository.group>project-group</repository.group>
</properties>
<distributionManagement>
<site>
<id>company-repository</id>
<name>Internal Releases</name>
<url>dav:${repository.url.sites}/project-site</url>
</site>
</distributionManagement>
...
</project>
警告:有人可能想知道为什么不直接将站点部分包含到企业 pom 中。这是不可能的,因为您不能在不造成困惑的情况下将多个站点部署到同一个站点存储库。使用上述方式不需要为每个项目创建一个存储库,而是能够将它们逻辑地分组到更大的组中,或者将它们留在 common-releases/snapshots 组/存储库中。
最佳答案
您可以查看 Apache Parent POM 或 Maven Parent POM。一个最小的企业 POM 应该是这样的:
<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.example</groupId>
<artifactId>example-parent</artifactId>
<version>1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Exmaple Parent POM</name>
<organization>
<name>Example Inc.</name>
</organization>
<!-- This marked as deprecated for Maven 3.x. This is checked by maven-enforcer-plugin -->
<!-- http://jira.codehaus.org/browse/MNG-5297 -->
<prerequisites>
<maven>${maven.version}</maven>
</prerequisites>
<scm>
<connection>scm:svn:https://example.com/repos/svn/ExmapleJava/example-parent/trunk/</connection>
<developerConnection>scm:svn:https://example.com/repos/svn/ExmapleJava/example-parent/trunk/</developerConnection>
<url>https://example.com/repos/websvn/browse/ExmapleJava/example-parent/trunk/</url>
</scm>
<distributionManagement>
<repository>
<id>nexus-example</id>
<name>Nexus Exmaple Release Repository</name>
<url>https://example.com/nexus/content/repositories/example-releases</url>
</repository>
<snapshotRepository>
<id>nexus-example</id>
<name>Nexus Exmaple Snapshot Repository</name>
<url>https://example.com/nexus/content/repositories/example-snapshots</url>
</snapshotRepository>
</distributionManagement>
<properties>
<maven.version>3.2</maven.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<surefire.version>2.19</surefire.version>
<javadoc.version>2.10.3</javadoc.version>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<configuration>
<excludeResources>true</excludeResources>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<mavenExecutorId>forked-path</mavenExecutorId>
<autoVersionSubmodules>true</autoVersionSubmodules>
<useReleaseProfile>false</useReleaseProfile>
<tagNameFormat>@{project.version}</tagNameFormat>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<plugin>
<artifactId>maven-help-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${javadoc.version}</version>
<configuration>
<quiet>true</quiet>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.6.1</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.4</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<buildNumberPropertyName>buildRevision</buildNumberPropertyName>
<timestampPropertyName>buildTimestamp</timestampPropertyName>
<scmBranchPropertyName>buildScmBranch</scmBranchPropertyName>
<revisionOnScmFailure>non-SCM</revisionOnScmFailure>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<generateBackupPoms>false</generateBackupPoms>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<version>1.10</version>
<configuration>
<includeConfigurationDirectoryInClasspath>false</includeConfigurationDirectoryInClasspath>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>${maven.version}</version>
<message>This project requires at least Maven ${maven.version}</message>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>example-release</id>
<build>
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
插件当然会因您的公司而异,但这可以帮助您入门。这实际上是我们的家长刚刚删除了我们的本地信息。
没有站点部署的信息,因为我们不使用它。如果你使用它,请设置它。
在没有的时候你的 POM 应该包含 <repositories>
和 <pluginRepositories>
因为这是不好的做法。理想情况下,您与 Nexus 镜像(在 settings.xml
中)中的 repo 组一起工作,您的所有请求。
继承并快乐。
如何处理网站:通常,每个项目都有自己的站点,应该在 dist mngt 部分中覆盖。这与人工制品不同。您将托管在 Nexus 上还是托管在像 Apache 这样的网络服务器上取决于您。底线是每个项目站点都需要其不同的 URL。
关于java - Nexus & Maven Corporate Pom - 它应该包含什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33522364/
我正在编写一个具有以下签名的 Java 方法。 void Logger(Method method, Object[] args); 如果一个方法(例如 ABC() )调用此方法 Logger,它应该
我是 Java 新手。 我的问题是我的 Java 程序找不到我试图用作的图像文件一个 JButton。 (目前这段代码什么也没做,因为我只是得到了想要的外观第一的)。这是我的主课 代码: packag
好的,今天我在接受采访,我已经编写 Java 代码多年了。采访中说“Java 垃圾收集是一个棘手的问题,我有几个 friend 一直在努力弄清楚。你在这方面做得怎么样?”。她是想骗我吗?还是我的一生都
我的 friend 给了我一个谜语让我解开。它是这样的: There are 100 people. Each one of them, in his turn, does the following
如果我将使用 Java 5 代码的应用程序编译成字节码,生成的 .class 文件是否能够在 Java 1.4 下运行? 如果后者可以工作并且我正在尝试在我的 Java 1.4 应用程序中使用 Jav
有关于why Java doesn't support unsigned types的问题以及一些关于处理无符号类型的问题。我做了一些搜索,似乎 Scala 也不支持无符号数据类型。限制是Java和S
我只是想知道在一个 java 版本中生成的字节码是否可以在其他 java 版本上运行 最佳答案 通常,字节码无需修改即可在 较新 版本的 Java 上运行。它不会在旧版本上运行,除非您使用特殊参数 (
我有一个关于在命令提示符下执行 java 程序的基本问题。 在某些机器上我们需要指定 -cp 。 (类路径)同时执行java程序 (test为java文件名与.class文件存在于同一目录下) jav
我已经阅读 StackOverflow 有一段时间了,现在我才鼓起勇气提出问题。我今年 20 岁,目前在我的家乡(罗马尼亚克卢日-纳波卡)就读 IT 大学。足以介绍:D。 基本上,我有一家提供簿记应用
我有 public JSONObject parseXML(String xml) { JSONObject jsonObject = XML.toJSONObject(xml); r
我已经在 Java 中实现了带有动态类型的简单解释语言。不幸的是我遇到了以下问题。测试时如下代码: def main() { def ks = Map[[1, 2]].keySet()
一直提示输入 1 到 10 的数字 - 结果应将 st、rd、th 和 nd 添加到数字中。编写一个程序,提示用户输入 1 到 10 之间的任意整数,然后以序数形式显示该整数并附加后缀。 public
我有这个 DownloadFile.java 并按预期下载该文件: import java.io.*; import java.net.URL; public class DownloadFile {
我想在 GUI 上添加延迟。我放置了 2 个 for 循环,然后重新绘制了一个标签,但这 2 个 for 循环一个接一个地执行,并且标签被重新绘制到最后一个。 我能做什么? for(int i=0;
我正在对对象 Student 的列表项进行一些测试,但是我更喜欢在 java 类对象中创建硬编码列表,然后从那里提取数据,而不是连接到数据库并在结果集中选择记录。然而,自从我这样做以来已经很长时间了,
我知道对象创建分为三个部分: 声明 实例化 初始化 classA{} classB extends classA{} classA obj = new classB(1,1); 实例化 它必须使用
我有兴趣使用 GPRS 构建车辆跟踪系统。但是,我有一些问题要问以前做过此操作的人: GPRS 是最好的技术吗?人们意识到任何问题吗? 我计划使用 Java/Java EE - 有更好的技术吗? 如果
我可以通过递归方法反转数组,例如:数组={1,2,3,4,5} 数组结果={5,4,3,2,1}但我的结果是相同的数组,我不知道为什么,请帮助我。 public class Recursion { p
有这样的标准方式吗? 包括 Java源代码-测试代码- Ant 或 Maven联合单元持续集成(可能是巡航控制)ClearCase 版本控制工具部署到应用服务器 最后我希望有一个自动构建和集成环境。
我什至不知道这是否可能,我非常怀疑它是否可能,但如果可以,您能告诉我怎么做吗?我只是想知道如何从打印机打印一些文本。 有什么想法吗? 最佳答案 这里有更简单的事情。 import javax.swin
我是一名优秀的程序员,十分优秀!