假设我们的项目中有以下包
org.xxx.dao,org.xxx.service,org.xxx.service.impl
所有的包都在源文件夹src/main/java中
我可以将包装配到分离的罐子里(xxx-dao.jar,xxx-service.jar,xxx-service-impl.jar)?
我正在处理的示例应用程序在测试中没有资源文件夹,我不知道为什么,所以我尝试手动创建资源文件夹,如下所示:
来自eclipse:关于java资源 > 新源文件夹 > src/test/resources
我现在可以看到资源文件夹出现在测试包中,但问题是,是否有任何其他配置我应该做maven或spring或单元测试所以我可以使用资源文件夹并从中加载文件?
请指教,谢谢.
我有maven 3,cobertura maven插件2.51和一些classe.我需要知道我班级的考试报道.但我不想测试setter/getters.所以我只想忽略它们.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
<check>
<haltOnFailure>false</haltOnFailure>
<lineRate>55</lineRate>
<branchRate>60</branchRate>
<packageLineRate>60</packageLineRate>
<packageBranchRate>60</packageBranchRate>
<totalLineRate>60</totalLineRate>
<totalBranchRate>60</totalBranchRate>
</check>
<instrumentation>
<excludes>
<exclude>com/FileCopier*.*</exclude>
<exclude>com/FileCopierWithCamel*.*</exclude>
<exclude>com/Main*.*</exclude>
</excludes>
</instrumentation>
</configuration>
<executions>
<execution>
<goals>
<goal>clean</goal>
<goal>cobertura</goal>
<goal>check</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
然后我添加以下ignore块
<ignores>
<!-- Ignore all setter and getter methods in your classes -->
<ignore>com.*.set*</ignore>
<ignore>com.*.get*</ignore>
<ignore>com.MyClass.getName</ignore>
</ignores>
Run Code Online (Sandbox Code Playgroud)
但似乎它不起作用.
我找到了这个链接:http: //jira.codehaus.org/browse/MCOBERTURA-52 看起来这个问题大约是5岁.我的问题有什么解决方案吗?
我在Maven repo上有一个作为jar发布的库,这个lib为用户对象提供了一些Groovy DSL.是否有可能为这个lib 提供IntelliJ GDSL?
我的意思是,把它放在罐子里面的META-INF或者Maven的里面pom.xml
,它会被IntelliJ IDEA自动处理和使用?
有没有什么方法可以为Eclipse做类似的事情?
刚出了个奇怪的错误.使用JUnit和Maven 3.0.3处理项目我在test/src/java文件夹中创建了一个测试类 - ClassifierUtilTest.java
带有@Test
注释方法和东西,以及两个实用程序类,仅用于测试环境(一个用于测试环境)用于绕过私有可见范围的一些静态方法和用于测试接口的一个模拟.
它在Maven 3.0.3(mvn test
)和Eclipse 3.7(作为/ JUnit测试运行)下运行良好,但是当其他人尝试mvn test
使用Maven 2.2.1时,它失败了.显然它试图将这些util类视为测试类,并且由于"没有@Test
注释的方法"和"多个构造函数" 而失败.
这不是JUnit错误(至少它不应该是,maven依赖是相同的junit:junit:4.9
),所以它似乎是严格的maven或maven-surefire-plugin
错误.我想知道是否有一些广为人知的Maven 2.2.1针对这个问题的解决方法?
我们正在尝试管理由多个Eclipse插件组成的项目.
一个插件依赖于第三方插件.它从名为bpmn2的库中导入一个类.该库是一个jar文件,不包含在Maven远程存储库中.
在本地,在Eclipse中,我们将库检出到工作空间中,并在Eclipse项目的类路径中引用.插件清单未明确声明对bpmn2的依赖性.哪个在本地工作......
我们尝试使用Jenkins进行持续集成.Multi-Plug-in-Project使用Maven和多个POM文件使用Maven tycho插件进行管理.
问题是Maven并不关心本地存在的库bpmn2(当然).所以我们认为使用Maven install:install将bpmn2安装到本地Maven资源库
./mvn install:install-file -Dfile=/home/someUser/bpmn2/org.eclipse.bpmn2_0.7.0.201111021300.jar -DgroupId=org.eclipse.bpmn2 -DartifactId=bpmn2 -Dversion=0.7.0 -Dpackaging=jar -DlocalRepositoryPath=/var/lib/jenkins/localRep/
Run Code Online (Sandbox Code Playgroud)
并使用库的依赖项来调整相应的POM
<dependencies>
<dependency>
<groupId>org.eclipse.bpmn2</groupId>
<artifactId>bpmn2</artifactId>
<version>0.7.0</version>
<type>jar</type>
</dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)
会工作.但事实并非如此.
Maven的输出是:
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: modeltype.bpmn2 1.0.0.qualifier
[ERROR] Missing requirement: modeltype.bpmn2 1.0.0.qualifier requires 'bundle org.eclipse.bpmn2 0.7.0' but it could not be found
[ERROR]
Run Code Online (Sandbox Code Playgroud)
问题是:
我们怎样才能更好地整合第三方图书馆?我认为,本地类路径引用不是更好图像的最佳解决方案.是否每个为项目开发的人都应该安装bpmn2库并且只使用清单中的依赖项?
我们在Maven做错了什么?本地存储库是
/var/lib/jenkins/localRep
Run Code Online (Sandbox Code Playgroud)
在将库安装到存储库之后,似乎创建的目录结构没问题.
/org/eclipse/bpmn2/bpmn2/0.7.0/bpmn2-0.7.0.jar
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?
我正在使用maven和maven-javadoc-plugin和umlgraph-doclet为我的项目创建javadoc.我的pom部分:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<inherited>false</inherited>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
<configuration>
<show>public</show>
<quiet>true</quiet>
<doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
<docletArtifact>
<groupId>org.umlgraph</groupId>
<artifactId>doclet</artifactId>
<version>5.1</version>
</docletArtifact>
<useStandardDocletOptions>true</useStandardDocletOptions>
<additionalparam>
-inferrel -inferdep -quiet -hide java.* -hide org.eclipse.* -collpackages java.util.* -postfixpackage
-nodefontsize 9 -nodefontpackagesize 7 -attributes -types -visibility -operations -constructors
-enumerations -enumconstants -views
</additionalparam>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>aggregate</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
生成图像并且看起来很好,当使用jdk1.6构建javadoc时,它们会自动集成到所有javadoc页面中.但是当使用jdk1.7构建时,图像仍然会被创建但不在javadoc页面内.即使在官方网站上使用v5.4,javadoc也是无图像的.并且maven的调试输出也没有提供任何线索.最重要的是,没有办法通过邮件联系其中一个UmlGraph开发者.
任何人都可以在这里给我一些建议,或者有一些想法如何解决这个问题?
我使用"maven-bundle-plugin"编写了一个OSGi包(其中我尝试将"jruby-complete-1.4.0.jar"作为osgi包,注意只有依赖是"jruby-complete-1.4.0.jar" ")..当我使用diag命令(#diag XX)通过osgi控制台检查捆绑包时,它说有些包丢失了;
osgi> diag 51
reference:file:dropins/jruby-complete-1.4.0.wso2v1.jar [51]
Direct constraints which are unresolved:
Missing optionally imported package com.sun.mirror.apt_0.0.0.
Missing optionally imported package com.sun.mirror.declaration_0.0.0.
Missing optionally imported package com.sun.mirror.type_0.0.0.
Missing optionally imported package com.sun.mirror.util_0.0.0.
Missing optionally imported package org.apache.bsf.util_0.0.0.
Missing optionally imported package org.jgrapht_0.0.0.
Missing optionally imported package org.jgrapht.graph_0.0.0.
Missing optionally imported package sun.misc_0.0.0.
Run Code Online (Sandbox Code Playgroud)
我的pom就像;
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Export-Package>
com.kenai.*,
com.sun.jna.*,
org.jruby.*,
org.joni.*,
</Export-Package>
<Import-Package>
*;resolution:=optional
</Import-Package>
<Fragment-Host>bsf-all</Fragment-Host>
<DynamicImport-Package>*</DynamicImport-Package>
<Embed-Dependency>*;scope=compile|runtime;inline=true;</Embed-Dependency>
</instructions>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
因此,我尝试在<Import-Package>
选项中添加那些"可选的缺失包",如pom …
我Missing artifact org.springframework.security:spring-security-parent:jar:3.0.7.RELEASE:compile
在pom.xml
添加maven依赖项时遇到错误Spring Security
但是当我删除该依赖项时,错误消失了.有人可以帮助我理解为什么会发生这种情况,我应该如何使用maven在我的应用程序中添加Spring Security 3?谢谢.
<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.think</groupId>
<artifactId>think</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>think Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<java-version>1.6</java-version>
<org.springframework-version>3.1.0.RELEASE</org.springframework-version>
<org.aspectj-version>1.6.10</org.aspectj-version>
<org.slf4j-version>1.6.1</org.slf4j-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework-version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<!-- Spring Security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-parent</artifactId>
<version>3.0.7.RELEASE</version>
</dependency>
<!-- AspectJ -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${org.aspectj-version}</version>
</dependency>
<!-- …
Run Code Online (Sandbox Code Playgroud) 我正在使用Maven shade插件制作超级jar,并希望使用jarsign插件进行签名.似乎jarsign插件在shade插件之前运行,所以我的最后一个jar没有被签名.有任何想法吗??
谢谢.