Tag: maven

Gradle不在发布的pom.xml中包含依赖项

我有一个Gradle项目我正在使用maven-publisher插件来安装我的android库到maven本地和一个maven回购。 这工作,但生成的pom.xml不包括任何依赖信息。 有没有解决方法来包含这些信息,还是我不得不回到maven插件并进行所有需要的手动configuration? 研究我意识到,我没有告诉出版物的依赖关系是什么,我只是指定的输出/神器,所以我需要一种方法来连接这个MavenPublication的依赖,但我还没有find如何做到这一点文件。 ————————————————– ———- Gradle 1.10 ————————————————– ———- 生成时间:2013-12-17 09:28:15 UTC 内部版本号:无 修订:36ced393628875ff15575fa03d16c1349ffe8bb6 Groovy:1.8.6 Ant:2013年7月8日编译的Apache Ant(TM)1.9.2版 常春藤:2.2.0 JVM:1.7.0_60(Oracle Corporation 24.60-b09) 操作系统:Mac OS X 10.9.2 x86_64 相关的build.gradle部分 //… apply plugin: 'android-library' apply plugin: 'robolectric' apply plugin: 'maven-publish' //… repositories { mavenLocal() maven { name "myNexus" url myNexusUrl } mavenCentral() } //… android.libraryVariants publishing { […]

在使用maven构build之后,src / main / resources中的资源未find

你好,我正在使用我的Java应用程序中的src / main / resources的configuration文件。 我正在阅读我的class级,就像这样: new BufferedReader(new FileReader(new File("src/main/resources/config.txt"))); 所以现在我使用mvn assembly:assembly来构build这个maven。 这是在我的pom.xml中的那一点: <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>2.3</version> <configuration> <finalName>TestSuite</finalName> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <archive> <manifest> <addClasspath>true</addClasspath> <mainClass>com.some.package.Test</mainClass> </manifest> </archive> </configuration> </plugin> 所以当我运行我的应用程序时,我得到这个错误: src\main\resources\config.txt (The system cannot find the path specified) 但是当我右键点击我的组装jar我可以看到里面,任何人都知道我在做什么错了?

无法从资源目录加载属性文件

我从Git仓库导入了一个项目,并在Eclipse中添加了Maven特性。 在资源文件夹中,我添加了一个名为myconf.properties的configuration文件。 现在,每当我尝试从我的Java代码打开这个文件,我得到FileNotFoundException 。 该文件也出现在maven编译项目之后生成的target/classes文件夹中。 谁能告诉我可能是什么问题? 我试图加载这个文件的Java代码是: props.load(new FileInputStream("myconf.properties")); 其中props是一个Properties对象。 任何人都可以给我一些关于如何解决这个问题的提示?

如何在maven安装目标中跳过testing,同时在maventesting目标中运行它们?

我有一个在同一个文件夹(src / test / java)中集成和unit testing的多模块maven项目。 集成testing用@Category(IntegrationTest.class)标记。 我想结束以下设置: 如果我运行mvn install ,我想要所有的testing编译,但我不想执行任何。 如果我运行mvn test ,我想要所有的testing编译,但只执行unit testing。 如果我运行mvn integration-test ,我想编译并执行所有的testing。 重要的一点是,我想在没有任何额外的命令行参数在pom.xmlconfiguration。 目前我想到了我的父pom.xml中的以下设置,其中唯一的问题是执行所有testing的#1: <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>${project.java.version}</source> <target>${project.java.version}</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.14.1</version> <dependencies> <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire-junit47</artifactId> <version>2.14.1</version> </dependency> </dependencies> <configuration> <includes> <include>**/*.class</include> </includes> <excludedGroups>cz.cuni.xrg.intlib.commons.IntegrationTest</excludedGroups> </configuration> </plugin> <plugin> <artifactId>maven-failsafe-plugin</artifactId> <version>2.14.1</version> <dependencies> <dependency> <groupId>org.apache.maven.surefire</groupId> […]

Eclipse + Maven src / main / java在Package Explorer的src文件夹中不可见

我想知道为什么我在Package Explorer的src节点中看不到以下文件夹 src/main/java src/main/resources src/test/java src/test/resources 我可以作为项目的直接子项访问这些文件夹,它们存在于文件系统中。 我正在使用Spring Tool Suite(Eclipse的STS)。 也许我可以以某种方式configurationEclipse?

tomcat-maven-plugin 403错误

当我使用mvn tomcat:部署tomcat-maven-plugin时出现了一个403错误: 无法执行目标org.codehaus.mojo:项目中的tomcat-maven-plugin:1.0:deploy(default-cli)my-webapp:无法调用Tomcatpipe理器:服务器返回的HTTP响应代码:403代表URL: http://localhost:8080/manager/text/deploy?path=%2Fdms&war= 我认为这是因为空战参数。 但是为什么它是空的? 在pom.xml中有: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifactId> <configuration> <warFile>target\my-webapp.war</warFile> <server>myserver</server> <url>http://localhost:8080/manager/text</url> <path>/dms</path> </configuration> </plugin>

JAVA_HOME受到Maven的影响

我正在使用统一的Maven构build来改造大量现有的Java项目。 由于每个项目都很成熟,并且已经build立了基于Ant的构build,所以我使用maven-antrun-plugin来执行现有的build.xml ,如下所示: <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <phase>compile</phase> <configuration> <tasks> <ant antfile="build.xml" target="compile" /> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> 当我运行mvn compile失败,出现这个消息: [INFO] An Ant BuildException has occured: The following error occurred while executing this line: build.xml:175: Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not […]

Maven – 取决于组装的邮编

我正在尝试让Project B下拉(并解压缩)由Project A构build的ZIP并将其部署到远程存储库。 ZIP是使用maven-assembly-plugin创build和连接的,包装types是pom : <artifactId>project-a</artifactId> <name>ZIP</name> <description>Used by Project B</description> <packaging>pom</packaging> … <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <id>distribution-package</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <descriptors> <descriptor>src/main/assembly/scripts.xml</descriptor> </descriptors> <tarLongFileMode>gnu</tarLongFileMode> </configuration> </execution> </executions> </plugin> 试图从Project B的pom中使用maven-dependency-plugin : <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>copy-scripts</id> <phase>package</phase> <goals> <goal>copy</goal> </goals> <configuration> <outputDirectory>${basedir}/target/staging</outputDirectory> <stripVersion>true</stripVersion> <artifactItems> <artifactItem> <groupId>…</groupId> <artifactId>…</artifactId> <version>…</version> <overWrite>true</overWrite> <type>zip</type> […]

Maven无法下载jar依赖项

我已经创build了一个非常简单的默认应用程序来testing我的Windows 7机器上的Eclipse Indigo / Maven v3.0.1安装程序。 Hello World应用程序从Eclipse运行良好。 现在从命令行我试图用mvn installtesting。 在这一点上,我看到Maven下载一系列依赖关系。 由于某种原因,虽然它会卡住下载一个,只会中途停止。 它不是每次都在同一个点上,但它现在一直是一样的jar文件,例如… http://repo1.maven.org/maven2/org/apache/maven/surefire/surefire-booter/2.5/surefire-booter-2.5.jar 如果我从浏览器下载这个文件,它完美的作品。 事实上相当快。 现在,如果我手动将下载的文件复制到我的.m2版本库目录中的相应目录中,则安装将继续下载依赖关系,直到它随机打到另一个目录为止。 这是我的POM,虽然我不确定它会有帮助,因为它是如此基本,似乎与mvn compile工作正常。 <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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.kyeema</groupId> <artifactId>QServer</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>QServer</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> </project> 这里有一些debugging输出引用了一些虚拟jar文件? [INFO] Surefire report directory: C:\workspace\QServer\target\surefire-reports [DEBUG] Setting system property [user.dir]=[C:\workspace\QServer] [DEBUG] […]

当Mavenunit testing失败时,如何让Jenkins构build失败?

我正在使用Jenkins,Maven 3.1和Java 1.6。 我有以下的目标和选项在jenkins设立的以下Maven工作… clean install -U -P cloudbees -P qa 下面是我的pom.xml surefireconfiguration… <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.17</version> <configuration> <reuseForks>true</reuseForks> <argLine>-Xmx2048m -XX:MaxPermSize=512M </argLine> <skipTests>false</skipTests> </configuration> </plugin> 但是,当我的unit testing失败时,Jenkins控制台输出仍然表示“BUILD SUCCESS”,并且构build标记为“unstable”而不是彻底失败。 如何在Jenkins中configuration(或Maven,如果它的结果​​是什么),这样如果任何unit testing失败,我的构build失败(不会变得不稳定或通过)? 以下是控制台输出的内容 17:08:04 MyProjectOrganizationControllerTest.testRecoverFromError » IllegalState Failed to… 17:08:04 MyProjectOrganizationControllerTest.testVerifyDistrictListPopulated » IllegalState 17:08:04 MyProjectOrganizationControllerTest.testUpdateSchool » IllegalState Failed to loa… 17:08:04 MyProjectOrganizationControllerTest.testDeleteSchool » IllegalState Failed to loa… […]