You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/03/02 13:03:46 UTC

svn commit: r155910 - in maven/maven-1/core/trunk/xdocs: faq.fml navigation.xml using/index.xml using/resources.xml

Author: brett
Date: Wed Mar  2 04:03:42 2005
New Revision: 155910

URL: http://svn.apache.org/viewcvs?view=rev&rev=155910
Log:
add resources documentation

Added:
    maven/maven-1/core/trunk/xdocs/using/resources.xml   (with props)
Modified:
    maven/maven-1/core/trunk/xdocs/faq.fml
    maven/maven-1/core/trunk/xdocs/navigation.xml
    maven/maven-1/core/trunk/xdocs/using/index.xml

Modified: maven/maven-1/core/trunk/xdocs/faq.fml
URL: http://svn.apache.org/viewcvs/maven/maven-1/core/trunk/xdocs/faq.fml?view=diff&r1=155909&r2=155910
==============================================================================
--- maven/maven-1/core/trunk/xdocs/faq.fml (original)
+++ maven/maven-1/core/trunk/xdocs/faq.fml Wed Mar  2 04:03:42 2005
@@ -735,22 +735,8 @@
 <!-- TODO: filters: add to using somewhere, and reference. Also add warning about reproducible artifacts... -->
         <p>
           This can be done using resource filtering. In your POM, add the filtering property to your existing
-          resources definition:
+          resources definition. Please refer to <a href="using/resources.html">Resources</a> for more information.
         </p>
-        <source><![CDATA[<resources>
-  <resource>
-    <filtering>true</filtering>
-    ...
-  </resource>
-</resources>]]></source>
-        <p>
-          At the moment, you must define Ant filters to achieve this. This can be done using a pre-goal on
-          <code>java:jar-resources</code>, for example:
-        </p>
-        <source><![CDATA[<preGoal name="java:jar-resources">
-  <ant:filter token="some.property" value="some_value" />
-  <ant:filter filtersfile="some.properties" />
-</preGoal>]]></source>
       </answer>
     </faq>
 <!-- TODO: actually, don't think this belongs here - calling ant scripts from maven

Modified: maven/maven-1/core/trunk/xdocs/navigation.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/core/trunk/xdocs/navigation.xml?view=diff&r1=155909&r2=155910
==============================================================================
--- maven/maven-1/core/trunk/xdocs/navigation.xml (original)
+++ maven/maven-1/core/trunk/xdocs/navigation.xml Wed Mar  2 04:03:42 2005
@@ -63,6 +63,7 @@
     <menu name="User's Guide">
       <item name="Using Maven" collapse="true"         href="/using/index.html">
         <item name="Building JARs"                     href="/using/jar.html" />
+        <item name="Resources"                         href="/using/resources.html" />
         <item name="Unit Testing"                      href="/using/tests.html" />
         <item name="Creating a Site"                   href="/using/site.html" />
         <item name="Source Control"                    href="/using/scm.html" />

Modified: maven/maven-1/core/trunk/xdocs/using/index.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/core/trunk/xdocs/using/index.xml?view=diff&r1=155909&r2=155910
==============================================================================
--- maven/maven-1/core/trunk/xdocs/using/index.xml (original)
+++ maven/maven-1/core/trunk/xdocs/using/index.xml Wed Mar  2 04:03:42 2005
@@ -33,6 +33,7 @@
       </p>
       <ul>
         <li><a href="jar.html">Building JARs</a> - How to build an individual library</li>
+        <li><a href="resources.html">Resources</a> - Adding more files to the generated library</li>
         <li><a href="tests.html">Unit Testing</a> - Running unit tests</li>
         <li><a href="war.html">Web Applications</a> - Working with web applications</li>
         <li><a href="site.html">Creating a Site</a> - Adding to the project web site</li>

Added: maven/maven-1/core/trunk/xdocs/using/resources.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/core/trunk/xdocs/using/resources.xml?view=auto&rev=155910
==============================================================================
--- maven/maven-1/core/trunk/xdocs/using/resources.xml (added)
+++ maven/maven-1/core/trunk/xdocs/using/resources.xml Wed Mar  2 04:03:42 2005
@@ -0,0 +1,98 @@
+<?xml version="1.0"?>
+<!--
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ -->
+
+<document>
+
+  <properties>
+    <title>Resources</title>
+    <author email="brett@apache.org">Brett Porter</author>
+  </properties>
+
+  <body>
+    <section name="Resources">
+      <p>
+        Resources are used to include additional files in the build, or use additional files for testing.
+        They are copied into the classpath before compilation.
+      </p>
+      <p>
+        Resources can be specified in two places: the <code>build</code> element
+        (<a href="../reference/project-descriptor.html#resources">reference</a>) and the <code>unitTest</code>
+        element (<a href="../reference/project-descriptor.html#unitTest_resources">reference</a>).
+        These resources are specified identically, but are used separately - the first for the main build (which is
+        also given to the unit tests), and the other only for the unit tests.
+      </p>
+      <p>
+        The following is a simple use of resources:
+      </p>
+      <source><![CDATA[<resources>
+  <resource>
+    <directory>src/main/resources</directory>
+  </resource>
+</resources>]]></source>
+      <p>
+        In this example, every file in <code>src/main/resources</code> is copied as is to the <code>target/classes</code>
+        directory, preserving any subdirectory structure.
+      </p>
+      <p>
+        Pattern sets can be used to include and exclude certain files, for example:
+      </p>
+      <source><![CDATA[<resource>
+    <directory>src/main/resources</directory>
+    <includes>
+      <include>**/*.xml</include>
+    </includes>
+    <excludes>
+      <exclude>directory1/dummy.xml</exclude>
+    </excludes>
+  </resource>]]></source>
+      <p>
+        In some cases, a specific resource might need to be copied to a particular subdirectory. Usually, this just means
+        having the same subdirectory structure in your resources directory, but another alternative is to use
+        <code>targetPath</code>:
+      </p>
+      <source><![CDATA[<resource>
+  <directory>src/main/meta</directory>
+  <targetPath>META-INF</targetPath>
+  <includes>
+    <include>MANIFEST.MF</include>
+  </includes>
+</resource>]]></source>
+      <p>
+        Resources can also be filtered for tokens like <code>@property.name@</code>, identically to Ant.
+        First, you must enable filtering for your resources.
+      </p>
+      <source><![CDATA[<resource>
+  <directory>src/main/resources</directory>
+  <filtering>true</filtering>
+</resource>]]></source>
+      <p>
+        At the moment, you must define Ant filters to achieve this. This can be done using a <code>preGoal</code> on
+        <code>java:jar-resources</code>, for example:
+      </p>
+      <source><![CDATA[<preGoal name="java:jar-resources">
+<ant:filter token="some.property" value="some_value" />
+<ant:filter filtersfile="some.properties" />
+</preGoal>]]></source>
+      <p>
+        Note however that filters may cause issues with keeping a single build reproducible. Please see the
+        <a href="bestpractices.html#reproducible">Best Practices</a> document for more information.
+      </p>
+    </section>
+  </body>
+</document>

Propchange: maven/maven-1/core/trunk/xdocs/using/resources.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/maven-1/core/trunk/xdocs/using/resources.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: maven/maven-1/core/trunk/xdocs/using/resources.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org