Tagged as maven

edit delete favorite
Posted by eric on Oct 19, 2007
Place the settings.xml in your user directory ~/.m2/settings.xml This is more flexible than managing repositories via the pom.xml, and is the recommended best-practice.
<settings>
  <profiles>
    <profile>
      <id>in-house-repos</id>
      <repositories>

        <!-- Add as many repositories as necessary -->
        <repository>
          <id>in-house-snap-1</id>
          <name>In-House Repository for Snapshots 1</name>
          <!-- look at 'servers' or 'proxies' if you can't connect to the url -->
          <url>http://ourrepo/maven/</url>
          <snapshotPolicy>always</snapshotPolicy>
        </repository>

      </repositories>
    </profile>
  </profiles>

  <!-- must activate the profile -->
  <activeProfiles>
    <activeProfile>in-house-repos</activeProfile>
  </activeProfiles>
</settings>
 
edit delete favorite
Posted by mavenmaven on Nov 08, 2007
You can use the Maven Help Plugin's describe goal. Note that you must give the plugin prefix as the argument to plugin, not it's artifact ID. For example, to find out the version of the install plugin.
mvn help:describe -Dplugin=install
 
edit delete favorite
Posted by mavenmaven on Nov 08, 2007
You must configure the source and target parameters in your pom, by default this is version 1.3. For example, to set the source and target JVM to 1.5, you should have in your pom.
<project>
  ...
  <build>
    ...
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
    </plugins>
    ...
  </build>
  ...
</project>
 
edit delete favorite
Posted by mavenmaven on Nov 08, 2007
The following code includes tools.jar on Sun JDKs (it is already included in the runtime for Mac OS X and some free JDKs). It adds it via a profile so compilation is less likely to break using other JDKs.
<project>
  ...
  <profiles>
    <profile>
      <id>default-tools.jar</id>
      <activation>
        <property>
          <name>java.vendor</name>
          <value>Sun Microsystems Inc.</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>com.sun</groupId>
          <artifactId>tools</artifactId>
          <version>1.4.2</version>
          <scope>system</scope>
          <systemPath>${java.home}/../lib/tools.jar</systemPath>
        </dependency>
      </dependencies>
    </profile>
  </profiles>
  ...
</project>
 
edit delete favorite
Posted by mavenmaven on Nov 08, 2007
The following are the Maven pom and settings XSD information.
<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">
  ...
</project>

<settings 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/settings-1.0.0.xsd">
  ...
</settings>
 
edit delete favorite
Posted by mavenmaven on Nov 08, 2007
Configure your ide to use the correct encoding. With eclipse, add -Dfile.encoding=ISO-8859-1 in eclipse.ini file.

To configure the file encoding used by mvn, add to MAVEN_OPTS the encoding (same as the ide). This can be made with adding MAVEN_OPTS="-Dfile.encoding=ISO-8859-1" in $HOME/.profile.

Finally, configure the output encoding in your pom:
<project>
  ...
  <build>
    ...
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-site-plugin</artifactId>
      <configuration>
        <outputEncoding>UTF-8</outputEncoding>
      </configuration>
   </plugin>
   ...
  </build>
  ...
</project>
 
Please submit any bugs/features and report abuse. Thanks!
Spacer
Spacer
Spacer
Top Tags
Spacer