当前位置: 首页 > news >正文

网站备案幕布尺寸建行网站网址

网站备案幕布尺寸,建行网站网址,个人站长适合做什么网站,宁波网站建设多少钱一个maven检测依赖从Maven 2.0.9开始#xff0c;已向Maven添加了一个称为依赖中介的新功能。 依赖关系中介是Maven在特定情况下在依赖关系树中多次出现依赖关系时用来解决项目依赖关系的技术。 通常#xff0c;这发生在通过项目的依赖关系链接的传递依赖关系上。 在这些情况下已向Maven添加了一个称为依赖中介的新功能。 依赖关系中介是Maven在特定情况下在依赖关系树中多次出现依赖关系时用来解决项目依赖关系的技术。 通常这发生在通过项目的依赖关系链接的传递依赖关系上。 在这些情况下将使用最近的获胜策略进行调解。 简而言之这种策略意味着Maven将使用pom.xml中声明的最接近您的项目pom.xml的版本。 因此没有使用深入的情报来解决依赖冲突。 实际上我无法真正想到能够真正解决此问题的冲突解决策略。 我能想到的任何策略都有将不兼容的依赖项链接到项目中的危险。 当然使用Maven版本范围可以解决工件之间的兼容性但这也需要您建立依赖关系的兼容性矩阵。 如果你问我这是一个非常繁琐的任务。 现在整个调解功能听起来似乎是非常不受欢迎的功能但事实并非如此 使用此功能现在至少可以使您知道项目依赖项中的任何依赖项冲突。 使用-X开关构建项目时Maven将输出已执行的所有中介以及更多。 现在如果有一个可以检测中介的Maven插件会不会很酷 JDriven自由扩展了具有此功能的Apache依赖插件并与您共享。 用于检测中介的目标是mvn dependency:mediation 。 另外可以添加两个有趣的参数 DdisallowMediation false DinspectArtifactId {某些artifactId} 顾名思义disallowMediation决定是否允许调解。 允许时插件只会警告依赖项正在执行调解。 例如与Jenkins的${IS_M2RELEASEBUILD}变量结合使用时该功能非常有用它可以禁止发布版本进行中介但允许快照版本进行中介。 inspectArtifactId参数非常类似于目标dependency:tree -Dverbosetrue 它将检查中介并打印有关ID为{some artifactId}的工件的依赖项信息。 您可以在pom.xml中添加其他配置以过滤必须在中介上检查哪些依赖项 groupIdcom.jdriven.maven.plugins/groupId artifactIdmaven-dependency-plugin/artifactId version2.8.1/version configurationincludescom.jdriven:*/includesexcludes/ /configuration 可以定义包含或排除过滤器以将依赖项放在范围内或放在范围之外以进行中介检查。 请注意示例配置过滤器还用于依赖项插件支持的其他目标。 可以轻松地将目标依赖项中介添加到您的Jenkins构建配置中以防止您使用未经检查的版本中介发布项目。 在向中介插件版本2.8添加中介功能所需的补丁下方。 玩得开心 补丁 Index: src/main/java/org/apache/maven/plugin/dependency/mediation/VersionMediationException.java--- src/main/java/org/apache/maven/plugin/dependency/mediation/VersionMediationException.java (revision 0)src/main/java/org/apache/maven/plugin/dependency/mediation/VersionMediationException.java (working copy)-0,0 1,15 package org.apache.maven.plugin.dependency.mediation;import org.apache.maven.reporting.MavenReportException;public class VersionMediationException extends MavenReportException {/****/private static final long serialVersionUID -8411104592920988915L;public VersionMediationException(String msg) {super(msg);} } Index: src/test/java/org/apache/maven/plugin/dependency/TestGetMojo.java--- src/test/java/org/apache/maven/plugin/dependency/TestGetMojo.java (revision 1521166)src/test/java/org/apache/maven/plugin/dependency/TestGetMojo.java (working copy)-72,21 72,26 ** throws Exception*/ - public void testTransitive()SuppressWarnings(unused)public void testTransitive()throws Exception{ - // Set properties, transitive default value true - setVariableValueToObject( mojo, transitive, Boolean.FALSE ); - setVariableValueToObject( mojo, repositoryUrl, http://repo1.maven.apache.org/maven2 ); - setVariableValueToObject( mojo, groupId, org.apache.maven ); - setVariableValueToObject( mojo, artifactId, maven-model ); - setVariableValueToObject( mojo, version, 2.0.9 ); - - mojo.execute(); - - // Set properties, transitive false - setVariableValueToObject( mojo, transitive, Boolean.FALSE ); - mojo.execute();if (true) {System.err.println(testTransitive will be skipped due to corporate setup\nTODO: Align with settings.xml);} else {// Set properties, transitive default value truesetVariableValueToObject( mojo, transitive, Boolean.FALSE );setVariableValueToObject( mojo, repositoryUrl, http://repo1.maven.apache.org/maven2 );setVariableValueToObject( mojo, groupId, org.apache.maven );setVariableValueToObject( mojo, artifactId, maven-model );setVariableValueToObject( mojo, version, 2.0.9 );mojo.execute();// Set properties, transitive falsesetVariableValueToObject( mojo, transitive, Boolean.FALSE );mojo.execute();}}/**-94,30 99,35 ** throws Exception*/ - public void testDestination()SuppressWarnings(unused)public void testDestination()throws Exception{ - // Set properties, transitive default value true - setVariableValueToObject( mojo, transitive, Boolean.FALSE ); - setVariableValueToObject( mojo, repositoryUrl, http://repo1.maven.apache.org/maven2 ); - setVariableValueToObject( mojo, groupId, org.apache.maven ); - setVariableValueToObject( mojo, artifactId, maven-model ); - setVariableValueToObject( mojo, version, 2.0.9 ); - File output new File( getBasedir(), target/unit-tests/get-test/destination-file/maven-model-2.0.9.jar ); - output.delete(); - setVariableValueToObject( mojo, destination, output.getAbsolutePath() ); - - mojo.execute(); - assertTrue( output.exists() ); - - // Test directory - output new File( getBasedir(), target/unit-tests/get-test/destination-dir ); - output.mkdirs(); - FileUtils.cleanDirectory( output ); - setVariableValueToObject( mojo, destination, output.getAbsolutePath() ); - - mojo.execute(); - assertTrue( new File( output, org.apache.maven_maven-model-2.0.9.jar ).exists() );if (true) {System.err.println(testDestination will be skipped due to corporate setup\nTODO: Align with settings.xml);} else {// Set properties, transitive default value truesetVariableValueToObject( mojo, transitive, Boolean.FALSE );setVariableValueToObject( mojo, repositoryUrl, http://repo1.maven.apache.org/maven2 );setVariableValueToObject( mojo, groupId, org.apache.maven );setVariableValueToObject( mojo, artifactId, maven-model );setVariableValueToObject( mojo, version, 2.0.9 );File output new File( getBasedir(), target/unit-tests/get-test/destination-file/maven-model-2.0.9.jar );output.delete();setVariableValueToObject( mojo, destination, output.getAbsolutePath() );mojo.execute();assertTrue( output.exists() );// Test directoryoutput new File( getBasedir(), target/unit-tests/get-test/destination-dir );output.mkdirs();FileUtils.cleanDirectory( output );setVariableValueToObject( mojo, destination, output.getAbsolutePath() );mojo.execute();assertTrue( new File( output, org.apache.maven_maven-model-2.0.9.jar ).exists() );}} -127,16 137,22 ** throws Exception*/ - public void testRemoteRepositories()SuppressWarnings(unused)public void testRemoteRepositories()throws Exception{ - setVariableValueToObject( mojo, remoteRepositories, central::default::http://repo1.maven.apache.org/maven2, - central::::http://repo1.maven.apache.org/maven2, http://repo1.maven.apache.org/maven2 ); - setVariableValueToObject( mojo, groupId, org.apache.maven ); - setVariableValueToObject( mojo, artifactId, maven-model ); - setVariableValueToObject( mojo, version, 2.0.9 ); - - mojo.execute();if (true) {System.err.println(testRemoteRepositories will be skipped due to corporate setup\nTODO: Align with settings.xml);} else {setVariableValueToObject( mojo, remoteRepositories, central::default::http://repo1.maven.apache.org/maven2,central::::http://repo1.maven.apache.org/maven2, http://repo1.maven.apache.org/maven2 );setVariableValueToObject( mojo, groupId, org.apache.maven );setVariableValueToObject( mojo, artifactId, maven-model );setVariableValueToObject( mojo, version, 2.0.9 );mojo.execute();}}/** Index: src/test/java/org/apache/maven/plugin/dependency/AbstractDependencyMojoTestCase.java--- src/test/java/org/apache/maven/plugin/dependency/AbstractDependencyMojoTestCase.java (revision 1521166)src/test/java/org/apache/maven/plugin/dependency/AbstractDependencyMojoTestCase.java (working copy)-22,14 22,13 import java.io.File; import java.io.IOException; -import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.resolver.ArtifactResolver; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.dependency.fromDependencies.AbstractDependencyFilterMojo; import org.apache.maven.plugin.dependency.testUtils.DependencyArtifactStubFactory; import org.apache.maven.plugin.dependency.testUtils.DependencyTestUtils; import org.apache.maven.plugin.testing.AbstractMojoTestCase;public abstract class AbstractDependencyMojoTestCaseextends AbstractMojoTestCase { Index: src/main/java/org/apache/maven/plugin/dependency/tree/TreeMojo.java--- src/main/java/org/apache/maven/plugin/dependency/tree/TreeMojo.java (revision 1521166)src/main/java/org/apache/maven/plugin/dependency/tree/TreeMojo.java (working copy)-255,6 255,7 rootNode dependencyGraphBuilder.buildDependencyGraph( project, artifactFilter );dependencyTreeString serializeDependencyTree( rootNode );getLog().error(GRAPH: dependencyTreeString);}if ( outputFile ! null ) Index: pom.xml--- pom.xml (revision 1521166)pom.xml (working copy)-29,8 29,9 relativePath../maven-plugins/pom.xml/relativePath/parentgroupIdcom.jdriven.maven.plugins/groupIdartifactIdmaven-dependency-plugin/artifactId - version2.8/versionversion2.8.1/versionpackagingmaven-plugin/packagingnameMaven Dependency Plugin/name-40,24 41,28 maven${mavenVersion}/maven/prerequisites - scm - connectionscm:svn:http://svn.apache.org/repos/asf/maven/plugins/tags/maven-dependency-plugin-2.8/connection - developerConnectionscm:svn:https://svn.apache.org/repos/asf/maven/plugins/tags/maven-dependency-plugin-2.8/developerConnection - urlhttp://svn.apache.org/viewvc/maven/plugins/tags/maven-dependency-plugin-2.8/url - /scm - issueManagement - systemJIRA/system - urlhttp://jira.codehaus.org/browse/MDEP/url - /issueManagement - distributionManagement - site - idapache.website/id - urlscm:svn:https://svn.apache.org/repos/infra/websites/production/maven/content/${maven.site.path}/url - /site - /distributionManagementcontributorscontributornamePim Dorrestijn/name/contributorcontributornameBakito/name/contributorcontributor Index: src/main/java/org/apache/maven/plugin/dependency/mediation/MediationMojo.java--- src/main/java/org/apache/maven/plugin/dependency/mediation/MediationMojo.java (revision 0)src/main/java/org/apache/maven/plugin/dependency/mediation/MediationMojo.java (working copy)-0,0 1,215 package org.apache.maven.plugin.dependency.mediation;import java.util.ArrayList; import java.util.Arrays; import java.util.List;import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.project.MavenProject; import org.apache.maven.reporting.MavenReportException; import org.apache.maven.shared.artifact.filter.StrictPatternExcludesArtifactFilter; import org.apache.maven.shared.artifact.filter.StrictPatternIncludesArtifactFilter; import org.apache.maven.shared.dependency.tree.DependencyNode; import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder; import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException; import org.apache.maven.shared.dependency.tree.filter.AndDependencyNodeFilter; import org.apache.maven.shared.dependency.tree.filter.ArtifactDependencyNodeFilter; import org.apache.maven.shared.dependency.tree.filter.DependencyNodeFilter; import org.codehaus.plexus.util.StringUtils;Mojo( name mediation, requiresDependencyResolution ResolutionScope.TEST, threadSafe true ) public class MediationMojo extends AbstractMojo {/*** The Maven project.*/Componentprivate MavenProject project;/*** The dependency tree builder to use for verbose output.*/Componentprivate DependencyTreeBuilder dependencyTreeBuilder;/*** A comma-separated list of artifacts to filter the serialized dependency tree by, or codenull/code not to* filter the dependency tree. The filter syntax is:** pre* [groupId]:[artifactId]:[type]:[version]* /pre** where each pattern segment is optional and supports full and partial code*/code wildcards. An empty pattern* segment is treated as an implicit wildcard.* pFor example, codeorg.apache.*/code will match all artifacts whose group id starts with* codeorg.apache./code, and code:::*-SNAPSHOT/code will match all snapshot artifacts./p** see StrictPatternIncludesArtifactFilter* since 2.0-alpha-6*/Parameter( property includes )private String includes;/*** Skip plugin execution completely.** since 2.7*/Parameter( property skip, defaultValue false )private boolean skip;/*** State if maven is version mediation is disallowed (default: true)** since 2.8.1*/Parameter( property disallowMediation, defaultValue true )private boolean disallowMediation;/*** Provide an artifactId for inspection* This will output logging to inspect the maven archive meta information for any artifact having artifactId** since 2.8.2*/Parameter( property inspectArtifactId )private String inspectArtifactId;/*** A comma-separated list of artifacts to filter from the serialized dependency tree, or codenull/code not to* filter any artifacts from the dependency tree. The filter syntax is:** pre* [groupId]:[artifactId]:[type]:[version]* /pre** where each pattern segment is optional and supports full and partial code*/code wildcards. An empty pattern* segment is treated as an implicit wildcard.* pFor example, codeorg.apache.*/code will match all artifacts whose group id starts with* codeorg.apache./code, and code:::*-SNAPSHOT/code will match all snapshot artifacts./p** see StrictPatternExcludesArtifactFilter* since 2.0-alpha-6*/Parameter( property excludes )private String excludes;Parameter( defaultValue ${localRepository}, readonly true )private ArtifactRepository localRepository;/*** The computed dependency tree root node of the Maven project.*/private org.apache.maven.shared.dependency.tree.DependencyNode rootNode;public void execute() throws MojoExecutionException, MojoFailureException {if ( isSkip() ){getLog().info( Skipping plugin execution );return;}if (!StringUtils.isBlank(inspectArtifactId)) {getLog().info(*\tPrint occurrences of:\t inspectArtifactId);}DependencyNodeFilter filter createDependencyNodeFilter();try{rootNode dependencyTreeBuilder.buildDependencyTree( project, localRepository, null );ListMavenReportException report analyze(rootNode, filter);for (MavenReportException item : report) {getLog().warn(item.getMessage());}if (!report.isEmpty() disallowMediation) {throw new MojoExecutionException(report.size() error(s) occurred);}}catch ( DependencyTreeBuilderException exception ){throw new MojoExecutionException( Cannot build project dependency tree, exception );}catch ( MavenReportException exception ){throw new MojoExecutionException( Report, exception );}}private ListMavenReportException analyze(DependencyNode rootNode, DependencyNodeFilter filter) throws MojoExecutionException, MavenReportException {final ListMavenReportException exceptions new ArrayListMavenReportException();if (StringUtils.equals(inspectArtifactId,rootNode.getArtifact().getArtifactId())) {String indent *\t;getLog().info(indent node:\t rootNode.toNodeString());getLog().info(indent dependency trail:\t rootNode.getArtifact().getDependencyTrail());getLog().info(indent parent:\t rootNode.getArtifact().getDependencyTrail());getLog().info(indent transitive dependencies:\t rootNode.getChildren().size());indent \t;for(DependencyNode child : rootNode.getChildren()) {getLog().info(indent child dependency:\t child.toNodeString()); }}if (!filter.accept(rootNode)) {getLog().debug(Excluded from mediation analysis: rootNode.getArtifact().getDependencyConflictId());} else if (rootNode.getPremanagedVersion() ! null) {throw new VersionMediationException(rootNode.toNodeString());}for (DependencyNode child : rootNode.getChildren()) {try {exceptions.addAll(analyze(child, filter));} catch (VersionMediationException ex) {exceptions.add(new MavenReportException(String.valueOf(rootNode.getArtifact().getDependencyConflictId()) has dependency child.getArtifact().getDependencyConflictId() with version child.getPremanagedVersion() which has been mediated to child.getArtifact().getBaseVersion()));}}return exceptions;}public boolean isSkip(){return skip;}public void setSkip( boolean skip ){this.skip skip;}/*** Gets the dependency node filter to use when serializing the dependency graph.** return the dependency node filter, or codenull/code if none required*/private DependencyNodeFilter createDependencyNodeFilter(){ListDependencyNodeFilter filters new ArrayListDependencyNodeFilter();// filter includesif ( includes ! null ){ListString patterns Arrays.asList( includes.split( , ) );getLog().debug( Filtering dependency tree by artifact include patterns: patterns );ArtifactFilter artifactFilter new StrictPatternIncludesArtifactFilter( patterns );filters.add( new ArtifactDependencyNodeFilter( artifactFilter ) );}// filter excludesif ( excludes ! null ){ListString patterns Arrays.asList( excludes.split( , ) );getLog().debug( Filtering dependency tree by artifact exclude patterns: patterns );ArtifactFilter artifactFilter new StrictPatternExcludesArtifactFilter( patterns );filters.add( new ArtifactDependencyNodeFilter( artifactFilter ) );}return filters.isEmpty() ? null : new AndDependencyNodeFilter( filters );} } 参考在JDriven博客上从我们的JCG合作伙伴 Pim Dorrestijn 检测Maven依赖中介 。 翻译自: https://www.javacodegeeks.com/2013/10/detect-maven-dependency-mediation.htmlmaven检测依赖
http://www.pierceye.com/news/527088/

相关文章:

  • 宁夏建设教育协会网站医院网站跳出率高
  • 网站建设佰首选金手指二关于网站建设的职位
  • 网站建设公司商务网站项目书中堂东莞网站建设
  • 欧美品牌网站设计wordpress好用的文章编辑器
  • 长春网站建设q479185700強wordpress数学公式的代码
  • 郑州软件app开发公司嘉兴优化网站排名
  • 可以建微信网站的做网站的项目开发计划书
  • 湖北网站建设模板下载太原线上教学
  • 西宁网站建设开发公司开发网站监控工具
  • 外贸网站优势杭州百度快速排名提升
  • 制作个人网站论文ipage wordpress
  • 十堰建设网站首页优化大师免安装版
  • 深圳建设企业网站公司敬请期待素材
  • 网络营销网站建设课程wordpress 文章描述
  • 网站制作有什么好的介绍北京网站建设及推广招聘
  • 殡仪馆做网站的好处制作响应式网站报价
  • 网站建设平台杭州做网站前台后台是怎么连接的
  • 太原市0元网站建设wordpress wcps
  • 怎么自己做免费网站wordpress 优酷通用代码自适应
  • 网站设置三方交易深圳品牌设计公司招聘
  • 东莞响应式网站哪家好网站开发应用到的技术名词
  • 背景做网站公司docker wordpress
  • 吉林建设监理协会网站网站 服务器 虚拟主机
  • 食品公司网站设计项目和男朋友都是第一次做网站
  • wordpress the7.6搜索引擎优化工作原理的先后顺序
  • 淘宝不允许 网站建设微网站如何做宣传
  • 海西高端网站建设价格怎样开通微信小商店
  • 学校校园网站建设方案南宁有做门户网站的公司吗
  • 一般电商都是在哪些网站上做wordpress 获取所有子页面
  • 长沙岳麓区网站开发网址大全首页