Tag: maven plugin

使用maven2使用jdk1.5编译项目

我设法使用maven2创建我的项目结构。 但是在使用mvn install编译我的项目时,-source 1.3不支持获取错误generics 谷歌搜索使用jdk1.5构建我的项目并添加了构建标记 4.0.0 com.myProject project jar 1.0-SNAPSHOT myapp http://maven.apache.org junit junit 3.8.1 test com.myProject project 1.5 1.5 但这不起作用。 任何提示?

maven:如何以独立于操作系统的方式加载tools.jar / classes.jar?

我正在使用一个maven插件,它需要一个包含在jdk的(windows)tools.jar中的类(mac它在classes.jar中)。 我将此添加为插件的显式依赖项,如下所示: sun.jdk classes 1.6.0 system ${java.home}/../Classes/classes.jar 如果我使用的是OS X,则可以正常工作。但是,如果我在Windows机器上进行开发,它就无法工作。 而且,我不喜欢使用../Classes。 是否有更好的方法加载JDK提供的类? 注意:我理解默认(Sun,现在是Oracle)是在lib / tools.jar中使用这些类发布JDK,并且唯一真正的exception值是使用重新打包的Apple JDK开发的那些。 尽管如此,我仍然对一个系统独立的方法感兴趣 – 它不依赖于特定的路径。

访问自定义maven报告插件中的类

我编写了一个自定义maven报告插件来输出有关spring-mvc类的一些基本信息。 在我的内部测试中,我可以看到这样的代码: public Set<Class> findControllerClasses(File buildOutputDir) throws IOException, ClassNotFoundException { Collection urls = ClasspathHelper.forJavaClassPath(); if (buildOutputDir != null) { urls.add(buildOutputDir.toURI().toURL()); } Reflections reflections = new Reflections(new ConfigurationBuilder().setUrls(urls)); Set<Class> types = reflections.getTypesAnnotatedWith(Controller.class); return types; } 拉入带注释的课程时效果很好。 但是,当我在另一个项目中使用报告插件时,不会选择带注释的类。 有人可以阐明如何访问已编译的类以进行报告吗? 或者这是否可能? 编辑:使用以下答案部分解决: 将maven-build-classpath添加到插件执行类路径 但是,如果它们在maven的runtimeClasspathElements var之外没有依赖项,那么它只加载类。 有没有办法将这些类合并到classrealm中?

在为mifos源代码构建war文件的过程中无法修复liqibase maven插件更新sql?

在构建战争文件期间出错。我们通过maven工具为mifos源代码构建war文件。 mifos是java的开源代码。 我们使用mvn clean package -Dmaven.test.skip = ture cmd并给出路径名称直到头文件夹的源代码,如下图所示 C:\mifos_src_code\mifos-head-2.1.6-0-gb6f7b86\mifos-head-e9d4674>mvn clean package -Dmaven.test. skip=true; [INFO] Scanning for projects… [WARNING] [WARNING] Some problems were encountered while building the effective model for org.mifos:mifos- db:jar:1.8-SNAPSHOT [WARNING] ‘build.plugins.plugin.(groupId:artifactId)’ must be unique but found duplicate declara tion of plugin org.liquibase:liquibase-maven-plugin @ line 132, column 21 [WARNING] ‘build.plugins.plugin.(groupId:artifactId)’ must be unique […]

Selenium 2 WebDriver UnhandledAlertException Java

在我开始受到责骂之前,我已经阅读了大部分关于此问题的现有问题,并应用了不同的解决方案(大多数重复同样的事情),但它仍然不适用于我。 我有一个包含所有必要依赖项的maven项目,测试中的网站专门针对IE进行,并要求我拥有特定的证书才能访问它。 我有它的证书,当我进入网站时,在加载页面之前它要求我确认我有证书,我需要在弹出窗口确认,然后登录页面完全加载。 我做过典型的做法: WebDriverWait wait = new WebDriverWait(driver, 3); try { // Handle alert box driver.navigate().to(“https://ke.m-pesa.com/ke/”); wait.until(ExpectedConditions.alertIsPresent()); Alert alert = driver.switchTo().alert(); alert.accept(); } catch(Exception e) { //whatever } 你能告诉我哪里出错了吗? 到目前为止,到目前为止我只使用了Selenium RC,所以这个webdriver的东西对我来说仍然是一种新的东西。 如果您需要我提供更多信息,请告诉我。 为什么我仍然得到UnhandledAlertException? 为什么我手动按下确定按钮之前无法访问登录页面?

如何以编程方式调用maven-resources-plugin

我正在编写一个自定义Maven插件,插件的一部分工作是过滤复制一些资源。 我写的代码看起来像这样: CopyResourcesMojo rm = new CopyResourcesMojo(); rm.setOutputDirectory(outputDir); //determined dynamically in a loop rm.setOverwrite(true); rm.setFilters(filters); //determined dynamically in a loop rm.setResources(this.resources); //Actually is of type List rm.execute(); //NulPointerException because rm’s project member is null. 这会抛出NullPointerException因为CopyResourceMojo无权访问我的mojo project ,而CopyResourceMojo没有我可以使用的setProject()方法。 我已经研究过使用mojo-executor-maven-plugin 。 我遇到的问题是使用这个库调用插件涉及编写代码,该镜像反映了该插件的XML配置。 我的插件会收到一个资源列表(就像maven-resources-plugin )所以如果我要使用mojo-executor-maven-plugin ,我想我必须编写代码来评估包含和排除。 我希望为此使用maven-resources-plugin ,因此该行为与将资源列表作为参数的其他插件100%一致。 有没有其他方法从代码调用插件,或将项目注入另一个mojo? 或者其他一些方法来实现这一目标?

如何外化maven构建文件?

我遇到了如何以XML格式对配置文件进行版本化的问题。 最简单的方法是编写XSLT更新。 应用程序的每个版本都有自己的XSLT更新。 所有这些更新文件都足够小,可以通过IDE管理,特别是它的DIFF工具。 由于该项目已经开发为Maven2 Java逻辑解决方案是通过maven构建文件触发这些更新。 这就是今天应用一组更新的部分: org.codehaus.mojo xml-maven-plugin compile transform config/xsltUpdates/input config/xsltUpdates/update1-8-3.xsl config/xsltUpdates/update1-8-3 config/xsltUpdates/update1-8-3 config/xsltUpdates/update1-8-9.xsl config/xsltUpdates/update1-8-9 config/xsltUpdates/update1-8-9 config/xsltUpdates/update1-9-0.xsl config/xsltUpdates/update1-9-0 config/xsltUpdates/update1-9-0 config/xsltUpdates/update1-10-0.xsl config/xsltUpdates/update1-10-0 config/xsltUpdates/update1-10-0 config/xsltUpdates/update1-10-0-1.xsl config/xsltUpdates/update1-10-0-1 config/xsltUpdates/update1-10-0-1 config/xsltUpdates/update1-10-0-2.xsl config/xsltUpdates/update1-10-0-2 config/xsltUpdates/update1-10-0-2 config/xsltUpdates/updateCurrent.xsl config/xsltUpdates/output net.sf.saxon saxon 8.7 我想在一些properties / xml文件导入中外化有关transformationSet的信息。 我的pom.xml文件将更清晰,外部化信息更易于维护。 我怎样才能做到这一点? 我可以在构建文件中使用一些迭代控制语句吗? 有没有办法从一些外部文件导入数据?

从树数据结构打印纯文本树(java)

我是一个狂热的粉丝 mvn dependency:tree 并希望打印一个外观相似的树作为普通的ascii文本作为我的java程序的输出。 com.totsp.gwt:maven-gwt-sample:war:1.0-SNAPSHOT +- com.google.gwt:gwt-servlet:jar:2.4.0:compile +- com.google.gwt:gwt-user:jar:2.4.0:provided | +- javax.validation:validation-api:jar:1.0.0.GA:provided | \- javax.validation:validation-api:jar:sources:1.0.0.GA:provided +- log4j:log4j:jar:1.2.14:compile \- junit:junit:jar:4.1:test 我希望实现这一目标的库很容易使用,但我找不到它。 我看到的最接近的替代品是: http : //code.google.com/p/j-text-utils/但它不如Maven那么好。 我在哪里可以找到一个打印树结构的库,文本几乎与mvn依赖:tree相同?

使用Maven Postman插件运行测试后无法发送电子邮件

我一直在尝试整个早上,但是在使用Maven从命令行运行我的Selenium测试套件后,没有成功发送电子邮件。 以下是我们如何从命令行运行该套件。 mvn surefire:test 这是使用Surefire插件运行一套TestNG / Selenium测试。 这很好用,我们想继续使用它。 我需要的是一种在每次运行套件后通过电子邮件发送结果的方法。 我遇到了Postman插件,它看起来很完美。 唯一的问题是我根本无法让它工作。 这是我的maven .pom文件。 4.0.0 com.mysite.carelogic.selenium automation 0.0.1-SNAPSHOT carelogic-automation automation tests for carelogic webapp org.seleniumhq.selenium selenium-java 2.37.1 org.testng testng 6.8.7 log4j log4j 1.2.17 commons-lang commons-lang 20030203.000129 org.apache.poi poi-ooxml 3.8-beta4 org.apache.maven.plugins maven-surefire-plugin 2.16 testng.xml ch.fortysix maven-postman-plugin 0.1.6 send surefire notification deploy send-mail false false conner@mysite.com Automation Test […]

从命令行运行maven插件的语法是什么。

我看到这里已经有人问过: 如何从命令行执行maven插件? 但我真的不明白答案。 看起来语法的forms如下: mvn foo:bar 但我不确定foo和bar应该是什么。 具体来说,我已经配置了maven-resource-plugin,如下所示: maven-resources-plugin 2.5 copy-resources prepare-package copy-resources 我已经尝试了mvn artifactId|id|phase|goal:artifactidId|id|phase|goal几种排列mvn artifactId|id|phase|goal:artifactidId|id|phase|goal但它们都没有工作。 我想我会停止试图强暴它,只是问互联网。 此外,这是在任何地方记录?