maven-2

How to keep Maven profiles which are activeByDefault active even if another profile gets activated?

安稳与你 提交于 2019-12-17 08:16:09
问题 I have a profile in my pom.xml which should be always active unless it is explicitely deactivated (-P !firstProfile). I solved this by using the activeByDefault flag: <profiles> <profile> <id>firstProfile</id> <activation> <activeByDefault>true</activeByDefault> </activation> ... </profile> </profiles> Now in the same pom.xml I have a second profile defined this should only be active if the profile is really activated (-P secondProfile). So the default behaviour is: firstProfile active,

Generate a Version.java file in Maven

独自空忆成欢 提交于 2019-12-17 08:14:10
问题 I have a Java project that I build using an Ant script. I am trying to convert the project to Maven. One of the tasks generates a Java source file called Version.java that contains a static String representation of the compilation timestamp, as follows: package com.foo.bar; public final class Version { public static String VERSION="100301.1046"; } The Ant task is very simple: <target name="version" depends="init" description="Create Version.java"> <echo file="src/${package.dir}/Version.java"

How to reference javadocs to dependencies in Maven's eclipse plugin when javadoc not attached to dependency

霸气de小男生 提交于 2019-12-17 08:11:16
问题 I use Eclipse, Maven, and Java in my development. I use Maven to download dependencies (jar files and javadoc when available) and Maven's eclipse plug-in to generate the .project and .classpath files for Eclipse. When the dependency downloaded does not have attached javadoc I manually add a link for the javadoc in the .classpath file so that I can see the javadoc for the dependency in Eclipse. Then when I run Maven's eclipse plugin to regenerate the .classpath file it of course wipes out that

How to reference javadocs to dependencies in Maven's eclipse plugin when javadoc not attached to dependency

故事扮演 提交于 2019-12-17 08:11:13
问题 I use Eclipse, Maven, and Java in my development. I use Maven to download dependencies (jar files and javadoc when available) and Maven's eclipse plug-in to generate the .project and .classpath files for Eclipse. When the dependency downloaded does not have attached javadoc I manually add a link for the javadoc in the .classpath file so that I can see the javadoc for the dependency in Eclipse. Then when I run Maven's eclipse plugin to regenerate the .classpath file it of course wipes out that

What is the difference between “mvn deploy” to a local repo and “mvn install”?

淺唱寂寞╮ 提交于 2019-12-17 08:06:17
问题 My team uses an internal team maven repo that is shared from a development server using Apache. We also run the Continuum CI server on the same machine. Maven builds in Continuum are run with the "install" goal, which copies the final artifact directly into the shared directory. The question is, what is the difference between adding files to the shared repo using mvn install and using the deploy goal (mvn-deploy plugin)? It seems to me that using mvn deploy creates additional configuration

What is the difference between “mvn deploy” to a local repo and “mvn install”?

回眸只為那壹抹淺笑 提交于 2019-12-17 08:06:10
问题 My team uses an internal team maven repo that is shared from a development server using Apache. We also run the Continuum CI server on the same machine. Maven builds in Continuum are run with the "install" goal, which copies the final artifact directly into the shared directory. The question is, what is the difference between adding files to the shared repo using mvn install and using the deploy goal (mvn-deploy plugin)? It seems to me that using mvn deploy creates additional configuration

How to configure Eclipse build path to use Maven dependencies?

China☆狼群 提交于 2019-12-17 08:01:41
问题 I would like to take advantage of the features that Maven provides for managing dependencies in a project. My brief understanding of how Maven works is that it will aquire the JARs needed and then build the project with these libraries. Currently I have a simple POM file set up as a test: <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">

How to configure Eclipse build path to use Maven dependencies?

六月ゝ 毕业季﹏ 提交于 2019-12-17 08:01:05
问题 I would like to take advantage of the features that Maven provides for managing dependencies in a project. My brief understanding of how Maven works is that it will aquire the JARs needed and then build the project with these libraries. Currently I have a simple POM file set up as a test: <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">

Maven command to determine which settings.xml file Maven is using

做~自己de王妃 提交于 2019-12-17 07:59:32
问题 How do I use maven command line to determine which settings.xml file Maven is picking up? 回答1: Start maven with -X option (debug) and examine the beginning of the output. There should be something like this: ... [INFO] Error stacktraces are turned on. [DEBUG] Reading global settings from c:\....\apache-maven-3.0.3\conf\settings.xml [DEBUG] Reading user settings from c:\....\.m2\settings.xml [DEBUG] Using local repository at C:\....\repository ... (Original directory names are removed by me)

Unzip dependency in maven

ⅰ亾dé卋堺 提交于 2019-12-17 07:30:20
问题 I have the following dependency in maven <dependency> <groupId>org.hyperic</groupId> <artifactId>sigar-dist</artifactId> <version>1.6.5.132</version> <type>zip</type> </dependency> This creates sigar-dist-1.6.5.132.zip in my repository. I have seen this question here, however I still can't make it work. How can I unzip the sigar-dist.zip and place the content in a directory in my project? What is the mvn call I have to do to make it work? 回答1: You can do it with dependencies:unpack