如您所知,SBT以某种方式与Maven兼容 - SBT识别简单的Maven POM,并且可以使用其中指定的依赖项和存储库.但是,SBT wiki说,如果在SBT项目定义中指定了内联依赖项,POM将被忽略(因此在这种情况下使用两者都是不可能的):
当存在内联依赖性声明时,将忽略Maven和Ivy配置(pom.xml和ivy.xml).
有谁知道,如果存在从Maven POM到SBT项目定义的任何转换器(将POM的XML转换为项目定义Scala代码)?我正在考虑编写这样的脚本(这将有助于将我的旧Scala/Maven项目迁移到SBT),但是首先想知道这个功能是否已经存在.
是否有一个CLI工具可用于快速查看Maven pom.xml文件的传递依赖性?
的意义是什么
<directory>${project.basedir}</directory>
Run Code Online (Sandbox Code Playgroud)
和
${project.build.directory}
Run Code Online (Sandbox Code Playgroud)
在pom.xml中
我在部署时遇到问题,这是我收到的错误消息:
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ core ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.296 s
[INFO] Finished at: 2014-11-26T17:05:00+02:00
[INFO] Final Memory: 13M/244M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:
deploy (default-deploy) on project core: Deployment failed: repository element w
as not specified in the POM inside distributionManagement element or in -DaltDep
loymentRepository=id::layout::url parameter -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e …
Run Code Online (Sandbox Code Playgroud) 如何将servlet API添加到项目的pom.xml中
mvnrepository.com有很多servlet api和类似命名的项目,我不知道哪个是正确的.或者他们都好吗?
我无法通过Maven依赖获取最新版本的Hibernate.看来我可以从Maven中央存储库获取的最新版本是3.2.6.GA,我对使用3.3.2.GA很感兴趣,这是hibernate.org网站上显示的最新版本.当我在项目的pom.xml中将我的hibernate依赖项修改为最新版本时,运行Maven构建时出现以下错误:
Missing:
----------
1) org.hibernate:hibernate:jar:3.3.2.GA
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.hibernate -DartifactId=hibernate -D
version=3.3.2.GA -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.hibernate -DartifactId=hibernate -Dve
rsion=3.3.2.GA -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[
id]
Run Code Online (Sandbox Code Playgroud)
一旦我这样做,我继续得到错误,表明我需要添加一个javassist依赖,然后我需要更新我的hibernate-validator依赖,这也需要在本地安装,然后我停下来,环顾四周,看看是否有一种更好的方法,可能将Maven指向JBoss/Hibernate存储库等等.与我使用的其他重要的开放源代码包(例如Spring或JUnit)相比,这真的很令人头疼 - 当我发布了新版本时do是更新依赖元素中的版本号,它只是工作.
我已经尝试将以下存储库声明添加到我的pom.xml中,但没有任何乐趣:
<repositories>
<repository>
<id>jboss</id>
<url>http://repository.jboss.org/maven2</url>
</repository>
</repositories>
Run Code Online (Sandbox Code Playgroud)
我搜索谷歌并没有找到太多帮助.有人可以提出最直接的方式来使用最新版本的hibernate或hibernate-core(3.3.2.GA),hibernate-validator(3.1.0)和hibernate-annotations(3.4.0)?
我在我的POM中有一个依赖项需要设置为"提供",因此它不包含在编译中,但它仍然可以在我的项目中引用.当我去运行测试时,我希望相同的依赖项具有"test"范围,因此我不必手动将jar添加到我的类路径中.有没有办法做到这一点或取得类似的结果?
这背后的推理是我在JBOSS lib目录中提供了一些常见的jar,所以我想使用它们并保持它们的"提供"范围用于构建的战争.但是,当我从命令行运行JUnits时,我想使用存储库中的jar而不是手动将其添加到我的类路径中.
提前致谢
当我尝试编译代码时,我不断收到此错误.我的目录中有pom.xml文件,但我不确定那里是否有错误.我发现互联网上只有一个关于此的链接,这不是我的情况:模块需要Maven项目配置
错误:Maven资源编译器:模块"更新程序"所需的Maven项目配置不可用.仅当从IDE启动外部构建时,才支持编译Maven项目.
这是我的pom文件的内容:
<?xml version="1.0" encoding="UTF-8"?>
<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.nothing.updater</groupId>
<artifactId>Updater</artifactId>
<version>1.0-SNAPSHOT</version>
<!--<dependencies>-->
<!--<dependency>-->
<!--<groupId>com.nothing.toolbox</groupId>-->
<!--<artifactId>Toolbox</artifactId>-->
<!--<version>1.1</version>-->
<!--</dependency>-->
<!--</dependencies>-->
</project>
Run Code Online (Sandbox Code Playgroud)
我将衷心感谢您的帮助.谢谢!
我想用我的maven项目得到一个工作的jar文件.
构建部分是:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.14</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>6.4.1</version>
</dependency>
</dependencies>
<configuration>
<consoleOutput>true</consoleOutput>
<configLocation>${basedir}/src/test/resources/checkstyle_swt1.xml</configLocation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptor>src/assembly/src.xml</descriptor>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
<addClasspath>true</addClasspath>
<mainClass>org.jis.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Run Code Online (Sandbox Code Playgroud)
所以我现在的问题是我不知道如何将mainclass正确地实现到我的pom.xml中以及稍后我的jar文件中.文件夹结构是:src/main/java/org/jis/Main.java但是如果我添加以下行
<mainClass>src.main.java.org.jis.Main</mainClass>
Run Code Online (Sandbox Code Playgroud)
它不起作用.
提前致谢
我有Maven POM文件的一些配置,在插件部分,我有maven tomcat插件,其中有一些配置如下:
<configuration>
<url>http://localhost:8080/manager/html</url>
<server>tomcat</server>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我想将url设置导出到某个属性文件,例如使用该键的tomcat.properties:
url=http://localhost:8080/manager/html
Run Code Online (Sandbox Code Playgroud)
如何在POM文件中读取此密钥?