我们的政策是只构建1个可部署的jar.所有特定于环境的配置都是分开的,我们一起构建它们.所以在我们当前的Ant流程中,我们为每个环境都有一个属性文件,循环遍历它们,并为每个环境创建一组配置文件.
在我目前的POM XML中,我只能在命令行中构建一个配置文件.是否可以通过Maven实现?
以下是POM.xml的一些相关部分
<!-- Define profiles here and make DEV as default profile -->
<profiles>
<!-- dev Profile -->
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<!-- qa Profile -->
<profile>
<id>qa</id>
<properties>
<env>qa</env>
</properties>
</profile>
<!-- prod Profile -->
<profile>
<id>prod</id>
<properties>
<env>prod</env>
</properties>
</profile>
</profiles>
...
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<filters>
<filter>env/${env}.properties</filter>
</filters>
<outputDirectory>${project.build.directory}/config/${env}
</outputDirectory>
<resources>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/config/default
</directory>
<includes>
<include>*.xml</include>
<include>*.properties</include>
</includes>
</resource>
Run Code Online (Sandbox Code Playgroud)
.....
谢谢,Prabhjot
我在我的linux机器上使用Maven v2.2.1.我有一个构建脚本,它调用mvn并根据构建状态执行某些操作.我注意到退出状态代码设置为0,无论mvn构建是失败还是成功.
我也碰到http://jira.codehaus.org/browse/MNG-3651声称该问题已经在V2.1.0-M1.有没有其他人注意到这一点?
谢谢!
XSLT 1.0中是否有任何可用的标准模板可以进行调整并将字段填充到最大长度?
谢谢,Prabhjot
我正在尝试使用JAXB将hibernate对象列表转换为XML.是否存在任何特殊注意事项或任何原因导致具有一对多关系的hibernate对象列表无法转换?
1.)似乎Hibernate提供的PersistentSet不是Serializable,因此不能被JAXB转换.我可能需要将它转换为"Serializable"集.它是否正确?如果是,我该如何实现?
编辑1.我将编写Set adapter class,类似于此示例链接.将更新我的发现.http://www.objectpartners.com/2010/01/25/using-jpa-and-jaxb-annotations-in-the-same-object/
如下所述,不需要转换PersistentSet,因为它已经可序列化.
编辑2(和解决方案).好的,我能够使它工作.感谢Maven的Schemagen提供了'java.sql.TimeStamp'与JAXB不兼容的提示.我写了一个将TimeStamp转换为Date的适配器.
感谢大家对此的指导.
我正在使用JAXB将Hibernate对象转换为XML.在我们的课程中,我们有大约50个领域,我只需要其中的10个.
基本上,我已经定义了具有2个属性的XmlType#propOrder.JAXB抱怨说,一些公众的吸气者不属于道具.我看到如果我没有使用XmlTransient/XmlElement标记属性,JAXB会抱怨它.有没有办法跳过在每个领域写'XmlTransient'?
我正在尝试使用maven来构建hibernate 3.6.1并且我有这个错误:
[WARNING] The POM for org.jboss.maven.plugins:maven-jdocbook-style-plugin:jar:2.0.0 is missing, no dependency information available
[DEBUG] org.jboss.maven.plugins:maven-jdocbook-style-plugin:jar:2.0.0:
[DEBUG] org.codehaus.plexus:plexus-utils:jar:1.1:runtime
[DEBUG] Verifying availability of C:\Users\Se\.m2\repository\org\jboss\maven\plugins\maven-jdocbook-style-plugin\2.0.0\maven-jdocbook-style-plugin-2.0.0.jar from [central (http://repo1.maven.org/maven2, releases)]
[DEBUG] Skipped remote update check for org.jboss.maven.plugins:maven-jdocbook-style-plugin:jar:2.0.0, locally cached artifact up-to-date.
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for http://repo1.maven.org/maven2
Downloading: http://repo1.maven.org/maven2/org/jboss/maven/plugins/maven-jdocbook-style-plugin/2.0.0/maven-jdocbook-style-plugin-2.0.0.jar
[DEBUG] Reading resolution tracking file C:\Users\Se\.m2\repository\org\jboss\maven\plugins\maven-jdocbook-style-plugin\2.0.0\maven-jdocbook-style-plugin-2.0.0.jar.lastUpdated
[DEBUG] Writing resolution tracking file C:\Users\Se\.m2\repository\org\jboss\maven\plugins\maven-jdocbook-style-plugin\2.0.0\maven-jdocbook-style-plugin-2.0.0.jar.lastUpdated
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[DEBUG] Looking up lifecyle mappings for packaging jar …Run Code Online (Sandbox Code Playgroud)