[maven-repo-helper] 01/01: Fixed a parsing error with poms containing a byte order mark

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Mon Jul 20 22:55:01 UTC 2015


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to branch master
in repository maven-repo-helper.

commit e5e43ff0c7b2a84b6f67ec443945341c4bb7b0c4
Author: Emmanuel Bourg <ebourg at apache.org>
Date:   Tue Jul 21 00:54:49 2015 +0200

    Fixed a parsing error with poms containing a byte order mark
---
 debian/changelog                                   |    8 +
 .../java/org/apache/commons/io/ByteOrderMark.java  |  184 ++++
 .../apache/commons/io/input/BOMInputStream.java    |  406 ++++++++
 src/main/java/org/debian/maven/repo/POMReader.java |    8 +-
 .../java/org/debian/maven/repo/POMTransformer.java |    7 +-
 .../java/org/debian/maven/repo/Repository.java     |    8 +-
 src/main/java/org/debian/maven/util/Readers.java   |   48 +
 .../java/org/debian/maven/TemporaryPomFolder.java  |   24 +-
 .../org/debian/maven/repo/POMTransformerTest.java  |    9 +
 src/test/resources/shiro-1.2.4.pom                 | 1043 ++++++++++++++++++++
 10 files changed, 1720 insertions(+), 25 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 7b3f3a3..c0cf205 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+maven-repo-helper (1.8.12) UNRELEASED; urgency=medium
+
+  * Fixed a parsing error with poms containing a byte order mark
+  * Always use ISO-8859-1 as the default charset when transforming poms
+    to improve the reproducibility of the builds
+
+ -- Emmanuel Bourg <ebourg at apache.org>  Tue, 21 Jul 2015 00:39:42 +0200
+
 maven-repo-helper (1.8.11) unstable; urgency=medium
 
   * Upload to unstable
diff --git a/src/main/java/org/apache/commons/io/ByteOrderMark.java b/src/main/java/org/apache/commons/io/ByteOrderMark.java
new file mode 100644
index 0000000..f77f723
--- /dev/null
+++ b/src/main/java/org/apache/commons/io/ByteOrderMark.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.commons.io;
+
+import java.io.Serializable;
+
+/**
+ * Byte Order Mark (BOM) representation - see {@link org.apache.commons.io.input.BOMInputStream}.
+ * 
+ * @see org.apache.commons.io.input.BOMInputStream
+ * @see <a href="http://en.wikipedia.org/wiki/Byte_order_mark">Wikipedia: Byte Order Mark</a>
+ * @see <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#sec-guessing">W3C: Autodetection of Character Encodings
+ *      (Non-Normative)</a>
+ * @version $Id: ByteOrderMark.java 1347571 2012-06-07 11:13:53Z sebb $
+ * @since 2.0
+ */
+public class ByteOrderMark implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /** UTF-8 BOM */
+    public static final ByteOrderMark UTF_8    = new ByteOrderMark("UTF-8",    0xEF, 0xBB, 0xBF);
+    
+    /** UTF-16BE BOM (Big-Endian) */
+    public static final ByteOrderMark UTF_16BE = new ByteOrderMark("UTF-16BE", 0xFE, 0xFF);
+    
+    /** UTF-16LE BOM (Little-Endian) */
+    public static final ByteOrderMark UTF_16LE = new ByteOrderMark("UTF-16LE", 0xFF, 0xFE);
+
+    /** 
+     * UTF-32BE BOM (Big-Endian)
+     * @since 2.2 
+     */
+    public static final ByteOrderMark UTF_32BE = new ByteOrderMark("UTF-32BE", 0x00, 0x00, 0xFE, 0xFF);
+    
+    /** 
+     * UTF-32LE BOM (Little-Endian)
+     * @since 2.2 
+     */
+    public static final ByteOrderMark UTF_32LE = new ByteOrderMark("UTF-32LE", 0xFF, 0xFE, 0x00, 0x00);
+    
+    private final String charsetName;
+    private final int[] bytes;
+
+    /**
+     * Construct a new BOM.
+     *
+     * @param charsetName The name of the charset the BOM represents
+     * @param bytes The BOM's bytes
+     * @throws IllegalArgumentException if the charsetName is null or
+     * zero length
+     * @throws IllegalArgumentException if the bytes are null or zero
+     * length
+     */
+    public ByteOrderMark(String charsetName, int... bytes) {
+        if (charsetName == null || charsetName.length() == 0) {
+            throw new IllegalArgumentException("No charsetName specified");
+        }
+        if (bytes == null || bytes.length == 0) {
+            throw new IllegalArgumentException("No bytes specified");
+        }
+        this.charsetName = charsetName;
+        this.bytes = new int[bytes.length];
+        System.arraycopy(bytes, 0, this.bytes, 0, bytes.length);
+    }
+
+    /**
+     * Return the name of the {@link java.nio.charset.Charset} the BOM represents.
+     *
+     * @return the character set name
+     */
+    public String getCharsetName() {
+        return charsetName;
+    }
+
+    /**
+     * Return the length of the BOM's bytes.
+     *
+     * @return the length of the BOM's bytes
+     */
+    public int length() {
+        return bytes.length;
+    }
+
+    /**
+     * The byte at the specified position.
+     *
+     * @param pos The position
+     * @return The specified byte
+     */
+    public int get(int pos) {
+        return bytes[pos];
+    }
+
+    /**
+     * Return a copy of the BOM's bytes.
+     *
+     * @return a copy of the BOM's bytes
+     */
+    public byte[] getBytes() {
+        byte[] copy = new byte[bytes.length];
+        for (int i = 0; i < bytes.length; i++) {
+            copy[i] = (byte)bytes[i];
+        }
+        return copy;
+    }
+
+    /**
+     * Indicates if this BOM's bytes equals another.
+     *
+     * @param obj The object to compare to
+     * @return true if the bom's bytes are equal, otherwise
+     * false
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof ByteOrderMark)) {
+            return false;
+        }
+        ByteOrderMark bom = (ByteOrderMark)obj;
+        if (bytes.length != bom.length()) {
+            return false;
+        }
+        for (int i = 0; i < bytes.length; i++) {
+            if (bytes[i] != bom.get(i)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Return the hashcode for this BOM.
+     *
+     * @return the hashcode for this BOM.
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        int hashCode = getClass().hashCode();
+        for (int b : bytes) {
+            hashCode += b;
+        }
+        return hashCode;
+    }
+
+    /**
+     * Provide a String representation of the BOM.
+     *
+     * @return the length of the BOM's bytes
+     */
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append(getClass().getSimpleName());
+        builder.append('[');
+        builder.append(charsetName);
+        builder.append(": ");
+        for (int i = 0; i < bytes.length; i++) {
+            if (i > 0) {
+                builder.append(",");
+            }
+            builder.append("0x");
+            builder.append(Integer.toHexString(0xFF & bytes[i]).toUpperCase());
+        }
+        builder.append(']');
+        return builder.toString();
+    }
+
+}
diff --git a/src/main/java/org/apache/commons/io/input/BOMInputStream.java b/src/main/java/org/apache/commons/io/input/BOMInputStream.java
new file mode 100644
index 0000000..20c16de
--- /dev/null
+++ b/src/main/java/org/apache/commons/io/input/BOMInputStream.java
@@ -0,0 +1,406 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.commons.io.input;
+
+import java.io.FilterInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+
+import org.apache.commons.io.ByteOrderMark;
+
+/**
+ * This class is used to wrap a stream that includes an encoded {@link ByteOrderMark} as its first bytes.
+ * 
+ * This class detects these bytes and, if required, can automatically skip them and return the subsequent byte as the
+ * first byte in the stream.
+ * 
+ * The {@link ByteOrderMark} implementation has the following pre-defined BOMs:
+ * <ul>
+ * <li>UTF-8 - {@link ByteOrderMark#UTF_8}</li>
+ * <li>UTF-16BE - {@link ByteOrderMark#UTF_16LE}</li>
+ * <li>UTF-16LE - {@link ByteOrderMark#UTF_16BE}</li>
+ * <li>UTF-32BE - {@link ByteOrderMark#UTF_32LE}</li>
+ * <li>UTF-32LE - {@link ByteOrderMark#UTF_32BE}</li>
+ * </ul>
+ * 
+ * 
+ * <h3>Example 1 - Detect and exclude a UTF-8 BOM</h3>
+ * 
+ * <pre>
+ * BOMInputStream bomIn = new BOMInputStream(in);
+ * if (bomIn.hasBOM()) {
+ *     // has a UTF-8 BOM
+ * }
+ * </pre>
+ * 
+ * <h3>Example 2 - Detect a UTF-8 BOM (but don't exclude it)</h3>
+ * 
+ * <pre>
+ * boolean include = true;
+ * BOMInputStream bomIn = new BOMInputStream(in, include);
+ * if (bomIn.hasBOM()) {
+ *     // has a UTF-8 BOM
+ * }
+ * </pre>
+ * 
+ * <h3>Example 3 - Detect Multiple BOMs</h3>
+ * 
+ * <pre>
+ * BOMInputStream bomIn = new BOMInputStream(in, 
+ *   ByteOrderMark.UTF_16LE, ByteOrderMark.UTF_16BE,
+ *   ByteOrderMark.UTF_32LE, ByteOrderMark.UTF_32BE
+ *   );
+ * if (bomIn.hasBOM() == false) {
+ *     // No BOM found
+ * } else if (bomIn.hasBOM(ByteOrderMark.UTF_16LE)) {
+ *     // has a UTF-16LE BOM
+ * } else if (bomIn.hasBOM(ByteOrderMark.UTF_16BE)) {
+ *     // has a UTF-16BE BOM
+ * } else if (bomIn.hasBOM(ByteOrderMark.UTF_32LE)) {
+ *     // has a UTF-32LE BOM
+ * } else if (bomIn.hasBOM(ByteOrderMark.UTF_32BE)) {
+ *     // has a UTF-32BE BOM
+ * }
+ * </pre>
+ * 
+ * @see org.apache.commons.io.ByteOrderMark
+ * @see <a href="http://en.wikipedia.org/wiki/Byte_order_mark">Wikipedia - Byte Order Mark</a>
+ * @version $Id: BOMInputStream.java 1346400 2012-06-05 14:48:01Z ggregory $
+ * @since 2.0
+ */
+public class BOMInputStream extends FilterInputStream {
+    private final boolean include;
+    /**
+     * BOMs are sorted from longest to shortest.
+     */
+    private final List<ByteOrderMark> boms;
+    private ByteOrderMark byteOrderMark;
+    private int[] firstBytes;
+    private int fbLength;
+    private int fbIndex;
+    private int markFbIndex;
+    private boolean markedAtStart;
+
+    /**
+     * Constructs a new BOM InputStream that excludes a {@link ByteOrderMark#UTF_8} BOM.
+     * 
+     * @param delegate
+     *            the InputStream to delegate to
+     */
+    public BOMInputStream(InputStream delegate) {
+        this(delegate, false, ByteOrderMark.UTF_8);
+    }
+
+    /**
+     * Constructs a new BOM InputStream that detects a a {@link ByteOrderMark#UTF_8} and optionally includes it.
+     * 
+     * @param delegate
+     *            the InputStream to delegate to
+     * @param include
+     *            true to include the UTF-8 BOM or false to exclude it
+     */
+    public BOMInputStream(InputStream delegate, boolean include) {
+        this(delegate, include, ByteOrderMark.UTF_8);
+    }
+
+    /**
+     * Constructs a new BOM InputStream that excludes the specified BOMs.
+     * 
+     * @param delegate
+     *            the InputStream to delegate to
+     * @param boms
+     *            The BOMs to detect and exclude
+     */
+    public BOMInputStream(InputStream delegate, ByteOrderMark... boms) {
+        this(delegate, false, boms);
+    }
+
+    /**
+     * Compares ByteOrderMark objects in descending length order.
+     */
+    private static final Comparator<ByteOrderMark> ByteOrderMarkLengthComparator = new Comparator<ByteOrderMark>() {
+
+        public int compare(ByteOrderMark bom1, ByteOrderMark bom2) {
+            int len1 = bom1.length();
+            int len2 = bom2.length();
+            if (len1 > len2) {
+                return -1;
+            }
+            if (len2 > len1) {
+                return 1;
+            }
+            return 0;
+        }
+    };
+
+    /**
+     * Constructs a new BOM InputStream that detects the specified BOMs and optionally includes them.
+     * 
+     * @param delegate
+     *            the InputStream to delegate to
+     * @param include
+     *            true to include the specified BOMs or false to exclude them
+     * @param boms
+     *            The BOMs to detect and optionally exclude
+     */
+    public BOMInputStream(InputStream delegate, boolean include, ByteOrderMark... boms) {
+        super(delegate);
+        if (boms == null || boms.length == 0) {
+            throw new IllegalArgumentException("No BOMs specified");
+        }
+        this.include = include;
+        // Sort the BOMs to match the longest BOM first because some BOMs have the same starting two bytes.
+        Arrays.sort(boms, ByteOrderMarkLengthComparator);
+        this.boms = Arrays.asList(boms);
+
+    }
+
+    /**
+     * Indicates whether the stream contains one of the specified BOMs.
+     * 
+     * @return true if the stream has one of the specified BOMs, otherwise false if it does not
+     * @throws IOException
+     *             if an error reading the first bytes of the stream occurs
+     */
+    public boolean hasBOM() throws IOException {
+        return getBOM() != null;
+    }
+
+    /**
+     * Indicates whether the stream contains the specified BOM.
+     * 
+     * @param bom
+     *            The BOM to check for
+     * @return true if the stream has the specified BOM, otherwise false if it does not
+     * @throws IllegalArgumentException
+     *             if the BOM is not one the stream is configured to detect
+     * @throws IOException
+     *             if an error reading the first bytes of the stream occurs
+     */
+    public boolean hasBOM(ByteOrderMark bom) throws IOException {
+        if (!boms.contains(bom)) {
+            throw new IllegalArgumentException("Stream not configure to detect " + bom);
+        }
+        return byteOrderMark != null && getBOM().equals(bom);
+    }
+
+    /**
+     * Return the BOM (Byte Order Mark).
+     * 
+     * @return The BOM or null if none
+     * @throws IOException
+     *             if an error reading the first bytes of the stream occurs
+     */
+    public ByteOrderMark getBOM() throws IOException {
+        if (firstBytes == null) {
+            fbLength = 0;
+            // BOMs are sorted from longest to shortest
+            final int maxBomSize = boms.get(0).length();
+            firstBytes = new int[maxBomSize];
+            // Read first maxBomSize bytes
+            for (int i = 0; i < firstBytes.length; i++) {
+                firstBytes[i] = in.read();
+                fbLength++;
+                if (firstBytes[i] < 0) {
+                    break;
+                }
+            }
+            // match BOM in firstBytes
+            byteOrderMark = find();
+            if (byteOrderMark != null) {
+                if (!include) {
+                    if (byteOrderMark.length() < firstBytes.length) {
+                        fbIndex = byteOrderMark.length();
+                    } else {
+                        fbLength = 0;
+                    }
+                }
+            }
+        }
+        return byteOrderMark;
+    }
+
+    /**
+     * Return the BOM charset Name - {@link ByteOrderMark#getCharsetName()}.
+     * 
+     * @return The BOM charset Name or null if no BOM found
+     * @throws IOException
+     *             if an error reading the first bytes of the stream occurs
+     * 
+     */
+    public String getBOMCharsetName() throws IOException {
+        getBOM();
+        return byteOrderMark == null ? null : byteOrderMark.getCharsetName();
+    }
+
+    /**
+     * This method reads and either preserves or skips the first bytes in the stream. It behaves like the single-byte
+     * <code>read()</code> method, either returning a valid byte or -1 to indicate that the initial bytes have been
+     * processed already.
+     * 
+     * @return the byte read (excluding BOM) or -1 if the end of stream
+     * @throws IOException
+     *             if an I/O error occurs
+     */
+    private int readFirstBytes() throws IOException {
+        getBOM();
+        return fbIndex < fbLength ? firstBytes[fbIndex++] : -1;
+    }
+
+    /**
+     * Find a BOM with the specified bytes.
+     * 
+     * @return The matched BOM or null if none matched
+     */
+    private ByteOrderMark find() {
+        for (ByteOrderMark bom : boms) {
+            if (matches(bom)) {
+                return bom;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Check if the bytes match a BOM.
+     * 
+     * @param bom
+     *            The BOM
+     * @return true if the bytes match the bom, otherwise false
+     */
+    private boolean matches(ByteOrderMark bom) {
+        // if (bom.length() != fbLength) {
+        // return false;
+        // }
+        // firstBytes may be bigger than the BOM bytes
+        for (int i = 0; i < bom.length(); i++) {
+            if (bom.get(i) != firstBytes[i]) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    // ----------------------------------------------------------------------------
+    // Implementation of InputStream
+    // ----------------------------------------------------------------------------
+
+    /**
+     * Invokes the delegate's <code>read()</code> method, detecting and optionally skipping BOM.
+     * 
+     * @return the byte read (excluding BOM) or -1 if the end of stream
+     * @throws IOException
+     *             if an I/O error occurs
+     */
+    @Override
+    public int read() throws IOException {
+        int b = readFirstBytes();
+        return b >= 0 ? b : in.read();
+    }
+
+    /**
+     * Invokes the delegate's <code>read(byte[], int, int)</code> method, detecting and optionally skipping BOM.
+     * 
+     * @param buf
+     *            the buffer to read the bytes into
+     * @param off
+     *            The start offset
+     * @param len
+     *            The number of bytes to read (excluding BOM)
+     * @return the number of bytes read or -1 if the end of stream
+     * @throws IOException
+     *             if an I/O error occurs
+     */
+    @Override
+    public int read(byte[] buf, int off, int len) throws IOException {
+        int firstCount = 0;
+        int b = 0;
+        while (len > 0 && b >= 0) {
+            b = readFirstBytes();
+            if (b >= 0) {
+                buf[off++] = (byte) (b & 0xFF);
+                len--;
+                firstCount++;
+            }
+        }
+        int secondCount = in.read(buf, off, len);
+        return secondCount < 0 ? firstCount > 0 ? firstCount : -1 : firstCount + secondCount;
+    }
+
+    /**
+     * Invokes the delegate's <code>read(byte[])</code> method, detecting and optionally skipping BOM.
+     * 
+     * @param buf
+     *            the buffer to read the bytes into
+     * @return the number of bytes read (excluding BOM) or -1 if the end of stream
+     * @throws IOException
+     *             if an I/O error occurs
+     */
+    @Override
+    public int read(byte[] buf) throws IOException {
+        return read(buf, 0, buf.length);
+    }
+
+    /**
+     * Invokes the delegate's <code>mark(int)</code> method.
+     * 
+     * @param readlimit
+     *            read ahead limit
+     */
+    @Override
+    public synchronized void mark(int readlimit) {
+        markFbIndex = fbIndex;
+        markedAtStart = firstBytes == null;
+        in.mark(readlimit);
+    }
+
+    /**
+     * Invokes the delegate's <code>reset()</code> method.
+     * 
+     * @throws IOException
+     *             if an I/O error occurs
+     */
+    @Override
+    public synchronized void reset() throws IOException {
+        fbIndex = markFbIndex;
+        if (markedAtStart) {
+            firstBytes = null;
+        }
+
+        in.reset();
+    }
+
+    /**
+     * Invokes the delegate's <code>skip(long)</code> method, detecting and optionallyskipping BOM.
+     * 
+     * @param n
+     *            the number of bytes to skip
+     * @return the number of bytes to skipped or -1 if the end of stream
+     * @throws IOException
+     *             if an I/O error occurs
+     */
+    @Override
+    public long skip(long n) throws IOException {
+        while (n > 0 && readFirstBytes() >= 0) {
+            n--;
+        }
+        return in.skip(n);
+    }
+}
diff --git a/src/main/java/org/debian/maven/repo/POMReader.java b/src/main/java/org/debian/maven/repo/POMReader.java
index 59a3092..a2cdc57 100644
--- a/src/main/java/org/debian/maven/repo/POMReader.java
+++ b/src/main/java/org/debian/maven/repo/POMReader.java
@@ -18,8 +18,7 @@ package org.debian.maven.repo;
 
 import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
+import java.io.IOException;
 import java.io.Reader;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -33,6 +32,7 @@ import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
 import org.debian.maven.repo.POMInfo.DependencyType;
+import org.debian.maven.util.Readers;
 
 /**
  * Reads relevant information from the POM.
@@ -50,11 +50,11 @@ public class POMReader {
 
     protected final XMLInputFactory factory = XMLInputFactory.newInstance();
 
-    public POMInfo readPom(File originalPom) throws XMLStreamException, FileNotFoundException {
+    public POMInfo readPom(File originalPom) throws XMLStreamException, IOException {
         if (!originalPom.exists()) {
             System.err.println("Cannot find pom file " + originalPom.getAbsolutePath());
         }
-        return readPom(new FileReader(originalPom));
+        return readPom(Readers.read(originalPom));
     }
 
     public POMInfo readPom(Reader originalPom) throws XMLStreamException {
diff --git a/src/main/java/org/debian/maven/repo/POMTransformer.java b/src/main/java/org/debian/maven/repo/POMTransformer.java
index d992b6c..b90c9f6 100644
--- a/src/main/java/org/debian/maven/repo/POMTransformer.java
+++ b/src/main/java/org/debian/maven/repo/POMTransformer.java
@@ -19,8 +19,6 @@ package org.debian.maven.repo;
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.Writer;
@@ -35,6 +33,7 @@ import javax.xml.stream.XMLStreamWriter;
 
 import org.debian.maven.cliargs.ArgumentsMap;
 import org.debian.maven.repo.POMInfo.DependencyType;
+import org.debian.maven.util.Readers;
 import org.debian.maven.util.Strings;
 import org.debian.maven.util.XMLWriterWrapper;
 
@@ -167,7 +166,7 @@ public class POMTransformer extends POMReader {
         });
     }
 
-    public void keepPomVersion(File pomFile) throws XMLStreamException, FileNotFoundException {
+    public void keepPomVersion(File pomFile) throws XMLStreamException, IOException {
         Dependency pom = readPom(pomFile).getThisPom();
         depRules.get(RULES).add(new DependencyRule(pom.getGroupId() + " " + pom.getArtifactId() + " " + pom.getType() + " " + pom.getVersion()));
     }
@@ -278,7 +277,7 @@ public class POMTransformer extends POMReader {
             Dependency parentDependency = null;
             String element = null;
             boolean afterText = false;
-            XMLStreamReader parser = factory.createXMLStreamReader(new BufferedReader(new FileReader(originalPom)));
+            XMLStreamReader parser = factory.createXMLStreamReader(new BufferedReader(Readers.read(originalPom)));
             out = new BufferedWriter(new FileWriter(targetPom));
             XMLStreamWriter writer = outFactory.createXMLStreamWriter(out);
             XMLWriterWrapper writerWrapper = new XMLWriterWrapper(writer);
diff --git a/src/main/java/org/debian/maven/repo/Repository.java b/src/main/java/org/debian/maven/repo/Repository.java
index b10da68..e94b983 100644
--- a/src/main/java/org/debian/maven/repo/Repository.java
+++ b/src/main/java/org/debian/maven/repo/Repository.java
@@ -18,7 +18,6 @@ package org.debian.maven.repo;
 
 import java.io.File;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -33,9 +32,8 @@ import java.util.TreeSet;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.xml.stream.XMLStreamException;
-
 import org.debian.maven.repo.POMInfo.DependencyType;
+import org.debian.maven.util.Readers;
 
 import static org.debian.maven.repo.DependencyRuleSet.*;
 
@@ -82,13 +80,13 @@ public class Repository {
             InputStream superPomSource = getClass().getResourceAsStream("/org/apache/maven/project/pom-4.0.0.xml");
             // The maven2 jars may not always be present in the classpath
             if (superPomSource != null) {
-                superPom = pomReader.readPom(new InputStreamReader(superPomSource));
+                superPom = pomReader.readPom(Readers.read(superPomSource));
                 superPom.getThisPom().setGroupId("__super__");
                 superPom.getThisPom().setArtifactId("__pom__");
                 superPom.getThisPom().setType("pom");
                 superPom.getThisPom().setSuperPom(true);
             }
-        } catch (XMLStreamException e) {
+        } catch (Exception e) {
             log.log(Level.SEVERE, "Unable to load the Maven super pom", e);
         }
     }
diff --git a/src/main/java/org/debian/maven/util/Readers.java b/src/main/java/org/debian/maven/util/Readers.java
new file mode 100644
index 0000000..d222c52
--- /dev/null
+++ b/src/main/java/org/debian/maven/util/Readers.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2015 Emmanuel bourg
+ *
+ * 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.
+ */
+
+package org.debian.maven.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+import org.apache.commons.io.input.BOMInputStream;
+
+import static org.apache.commons.io.ByteOrderMark.*;
+
+public class Readers {
+
+    /**
+     * Detects a BOM in the specified input stream and returns a Reader
+     * using the charset detected, or ISO-8859-1 otherwise.
+     */
+    public static Reader read(InputStream in) throws IOException {
+        BOMInputStream bis = new BOMInputStream(in, false, UTF_8, UTF_16BE, UTF_16LE, UTF_32BE, UTF_32LE);
+        if (bis.hasBOM()) {
+            return new InputStreamReader(bis, bis.getBOM().getCharsetName());
+        } else {
+            return new InputStreamReader(bis, "ISO-8859-1");
+        }
+    }
+
+    public static Reader read(File file) throws IOException {
+        return read(new FileInputStream(file));
+    }
+}
diff --git a/src/test/java/org/debian/maven/TemporaryPomFolder.java b/src/test/java/org/debian/maven/TemporaryPomFolder.java
index 19b44bc..25e024a 100644
--- a/src/test/java/org/debian/maven/TemporaryPomFolder.java
+++ b/src/test/java/org/debian/maven/TemporaryPomFolder.java
@@ -1,11 +1,10 @@
 package org.debian.maven;
 
+import java.io.Closeable;
 import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
+import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.InputStreamReader;
+import java.io.InputStream;
 import java.io.Reader;
 import java.net.URISyntaxException;
 import java.net.URL;
@@ -15,18 +14,19 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.commons.io.IOUtils;
+import org.debian.maven.util.Readers;
 import org.junit.rules.TemporaryFolder;
 
 public class TemporaryPomFolder extends TemporaryFolder {
 
-    private List<Reader> openedReaders = new ArrayList<Reader>();
+    private List<Closeable> openedReaders = new ArrayList<Closeable>();
     private File updatedPom;
 
     public String pomInUse;
 
     public File copyResource(String resource, File file) throws IOException {
-        final FileWriter out = new FileWriter(file);
-        final Reader in = read(resource);
+        InputStream in = this.getClass().getResourceAsStream("/" + resource);
+        FileOutputStream out = new FileOutputStream(file);
         IOUtils.copy(in, out);
         in.close();
         out.close();
@@ -39,8 +39,8 @@ public class TemporaryPomFolder extends TemporaryFolder {
         return copyResource(resource, pom);
     }
 
-    public Reader read(String resource) {
-        Reader r = new InputStreamReader(this.getClass().getResourceAsStream("/" + resource));
+    public Reader read(String resource) throws IOException {
+        Reader r = Readers.read(this.getClass().getResourceAsStream("/" + resource));
         openedReaders.add(r);
         return r;
     }
@@ -52,15 +52,15 @@ public class TemporaryPomFolder extends TemporaryFolder {
         return updatedPom;
     }
 
-    public Reader read(File f) throws FileNotFoundException {
-        Reader r = new FileReader(f);
+    public Reader read(File file) throws IOException {
+        Reader r = Readers.read(file);
         openedReaders.add(r);
         return r;
     }
 
     @Override
     protected void after() {
-        for (Reader reader : openedReaders) {
+        for (Closeable reader : openedReaders) {
             try {
                 reader.close();
             } catch (IOException ex) {
diff --git a/src/test/java/org/debian/maven/repo/POMTransformerTest.java b/src/test/java/org/debian/maven/repo/POMTransformerTest.java
index 0911c05..ea3401c 100644
--- a/src/test/java/org/debian/maven/repo/POMTransformerTest.java
+++ b/src/test/java/org/debian/maven/repo/POMTransformerTest.java
@@ -327,4 +327,13 @@ public class POMTransformerTest {
         
         assertTrue("Guice is missing from the dependencies", guiceFound);
     }
+
+    @Test
+    public void testTransformPomWithByteOrderMark() throws Exception {
+        File pom = tmpDir.usePom("shiro-1.2.4.pom");
+        instance.getRulesFiles().addDefaultRules();
+        instance.transformPom(pom, tmpDir.updatedPom(), true, true, false, false, null, null);
+
+        assertTrue("The transformation failed", tmpDir.updatedPom().exists());
+    }
 }
diff --git a/src/test/resources/shiro-1.2.4.pom b/src/test/resources/shiro-1.2.4.pom
new file mode 100644
index 0000000..6ed97d5
--- /dev/null
+++ b/src/test/resources/shiro-1.2.4.pom
@@ -0,0 +1,1043 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you 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.
+  -->
+<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">
+    <modelVersion>4.0.0</modelVersion>
+
+    <!-- pick up Apache distributionManagement for releasing (snapshots, releases, etc): -->
+    <parent>
+        <groupId>org.apache</groupId>
+        <artifactId>apache</artifactId>
+        <version>7</version>
+    </parent>
+
+    <groupId>org.apache.shiro</groupId>
+    <artifactId>shiro-root</artifactId>
+    <packaging>pom</packaging>
+    <version>1.2.4</version>
+
+    <name>Apache Shiro</name>
+    <url>http://shiro.apache.org/</url>
+    <description>
+        Apache Shiro is a powerful and flexible open-source security framework that cleanly handles
+        authentication, authorization, enterprise session management, single sign-on and cryptography services.
+    </description>
+    <inceptionYear>2004</inceptionYear>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/shiro/tags/shiro-root-1.2.4</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/shiro/tags/shiro-root-1.2.4</developerConnection>
+        <url>http://svn.apache.org/repos/asf/shiro/tags/shiro-root-1.2.4</url>
+    </scm>
+    <issueManagement>
+        <system>Jira</system>
+        <url>http://issues.apache.org/jira/browse/SHIRO</url>
+    </issueManagement>
+    <ciManagement>
+        <system>Hudson</system>
+        <url>http://hudson.zones.apache.org/hudson/view/Shiro/</url>
+    </ciManagement>
+
+    <distributionManagement>
+        <site>
+            <id>shiro.website</id>
+            <name>Apache Shiro Site</name>
+            <url>scm:svn:https://svn.apache.org/repos/asf/shiro/site/publish/static/latest</url>
+        </site>
+    </distributionManagement>
+
+    <properties>
+
+        <!-- Replaced by the build number plugin at build time: -->
+        <buildNumber>${user.name}-${maven.build.timestamp}</buildNumber>
+
+        <!-- non-dependency-based properties: -->
+        <shiro.osgi.importRange>[1.2, 2)</shiro.osgi.importRange>
+
+        <!-- Compile 3rd party dependencies: -->
+        <!-- Don't change this version without also changing the shiro-aspect and shiro-features
+             modules' OSGi metadata: -->
+        <aspectj.version>1.6.12</aspectj.version>
+        <commons.cli.version>1.2</commons.cli.version>
+        <commons.codec.version>1.4</commons.codec.version>
+        <crowd.version>1.5.2</crowd.version>
+        <!-- Don't change this version without also changing the shiro-ehcache and shiro-features
+             modules' OSGi metadata: -->
+        <ehcache.version>2.5.0</ehcache.version>
+        <hsqldb.version>1.8.0.7</hsqldb.version>
+        <jdk.version>1.6</jdk.version>
+        <jetty.version>6.1.26</jetty.version>
+        <!-- Don't change this version without also changing the shiro-quartz and shiro-features
+             modules' OSGi metadata: -->
+        <quartz.version>1.6.1</quartz.version>
+        <slf4j.version>1.6.4</slf4j.version>
+        <spring.version>3.1.0.RELEASE</spring.version>
+        <guice.version>3.0</guice.version>
+
+        <!-- Test 3rd-party dependencies: -->
+        <easymock.version>3.1</easymock.version>
+        <gmaven.version>1.3</gmaven.version>
+        <groovy.version>1.8.5</groovy.version>
+        <junit.version>4.8.2</junit.version>
+
+    </properties>
+
+    <mailingLists>
+        <mailingList>
+            <name>Apache Shiro Users Mailing List</name>
+            <subscribe>user-subscribe at shiro.apache.org</subscribe>
+            <unsubscribe>user-unsubscribe at shiro.apache.org</unsubscribe>
+            <post>user at shiro.apache.org</post>
+            <!--archive/-->
+            <!--otherArchives-->
+        </mailingList>
+        <mailingList>
+            <name>Apache Shiro Developers Mailing List</name>
+            <subscribe>dev-subscribe at shiro.apache.org</subscribe>
+            <unsubscribe>dev-unsubscribe at shiro.apache.org</unsubscribe>
+            <post>dev at shiro.apache.org</post>
+            <!--archive/-->
+            <!--otherArchives-->
+        </mailingList>
+    </mailingLists>
+
+
+    <developers>
+        <developer>
+            <id>aditzel</id>
+            <name>Allan Ditzel</name>
+            <email>aditzel at apache.org</email>
+            <url>http://www.allanditzel.com</url>
+            <organization>Apache Software Foundation</organization>
+            <timezone>-5</timezone>
+        </developer>
+        <developer>
+            <id>jhaile</id>
+            <name>Jeremy Haile</name>
+            <email>jhaile at apache.org</email>
+            <url>http://www.jeremyhaile.com</url>
+            <organization>Mobilization Labs</organization>
+            <organizationUrl>http://www.mobilizationlabs.com</organizationUrl>            
+            <timezone>-5</timezone>
+        </developer>
+        <developer>
+            <id>lhazlewood</id>
+            <name>Les Hazlewood</name>
+            <email>lhazlewood at apache.org</email>
+            <url>http://www.leshazlewood.com</url>
+            <organization>Katasoft</organization>
+            <organizationUrl>http://www.katasoft.com</organizationUrl>
+            <timezone>-8</timezone>
+        </developer>
+        <developer>
+            <id>kaosko</id>
+            <name>Kalle Korhonen</name>
+            <email>kaosko at apache.org</email>
+            <url>http://tynamo.org</url>
+            <organization>Apache Software Foundation</organization>
+            <timezone>-8</timezone>
+        </developer>
+        <developer>
+            <id>pledbrook</id>
+            <name>Peter Ledbrook</name>
+            <email>p.ledbrook at cacoethes.co.uk</email>
+            <url>http://www.cacoethes.co.uk/blog/</url>
+            <organization>SpringSource</organization>
+            <organizationUrl>http://www.springsource.com/</organizationUrl>
+            <timezone>0</timezone>
+        </developer>
+        <developer>
+            <id>tveil</id>
+            <name>Tim Veil</name>
+            <email>tveil at apache.org</email>
+        </developer>
+        <developer>
+            <id>bdemers</id>
+            <name>Brian Demers</name>
+            <email>bdemers at apache.org</email>
+            <url>http://about.me/brian.demers</url>
+            <organization>Sonatype</organization>
+            <organizationUrl>http://www.sonatype.com/</organizationUrl>
+            <timezone>-5</timezone>
+        </developer>
+        <developer>
+            <id>jbunting</id>
+            <name>Jared Bunting</name>
+            <email>jbunting at apache.org</email>
+            <organization>Apache Software Foundation</organization>
+            <timezone>-6</timezone>
+        </developer>
+    </developers>
+
+    <modules>
+        <module>core</module>
+        <module>web</module>
+        <module>support</module>
+        <module>samples</module>
+        <module>tools</module>
+        <module>all</module>
+    </modules>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.felix</groupId>
+                    <artifactId>maven-bundle-plugin</artifactId>
+                    <version>2.1.0</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-gpg-plugin</artifactId>
+                    <version>1.1</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-site-plugin</artifactId>
+                    <version>3.3</version>    
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-scm-publish-plugin</artifactId>
+                    <version>1.0</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.rat</groupId>
+                    <artifactId>apache-rat-plugin</artifactId>
+                    <version>0.8</version>
+                    <configuration>
+                    		<!-- note that this configuration needs to be maintain both in pluginManagement and reporting sections -->
+                        <excludes>
+                            <exclude>**/.externalToolBuilders/*</exclude>
+                            <exclude>**/infinitest.filters</exclude>
+                            <!-- Apparently some test in samples/spring-client generates velocity log - would better to reconfigure to output to target/ -->
+                            <exclude>velocity.log</exclude>
+                        </excludes>
+                    </configuration>
+                </plugin>
+                <plugin>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>versions-maven-plugin</artifactId>
+                    <version>1.2</version>
+                </plugin>
+                <!-- Allow writing tests in Groovy: -->
+                <plugin>
+                    <groupId>org.codehaus.gmaven</groupId>
+                    <artifactId>gmaven-plugin</artifactId>
+                    <version>${gmaven.version}</version>
+                    <configuration>
+                        <providerSelection>1.7</providerSelection>
+                        <source>src/main/groovy</source>
+                    </configuration>
+                    <dependencies>
+                        <dependency>
+                            <groupId>org.codehaus.gmaven.runtime</groupId>
+                            <artifactId>gmaven-runtime-1.7</artifactId>
+                            <version>${gmaven.version}</version>
+                            <exclusions>
+                                <exclusion>
+                                    <groupId>org.codehaus.groovy</groupId>
+                                    <artifactId>groovy-all</artifactId>
+                                </exclusion>
+                            </exclusions>
+                        </dependency>
+                        <dependency>
+                            <groupId>org.codehaus.groovy</groupId>
+                            <artifactId>groovy-all</artifactId>
+                            <version>${groovy.version}</version>
+                        </dependency>
+                    </dependencies>
+                </plugin>
+                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+                <plugin>
+                	<groupId>org.eclipse.m2e</groupId>
+                	<artifactId>lifecycle-mapping</artifactId>
+                	<version>1.0.0</version>
+                	<configuration>
+                		<lifecycleMappingMetadata>
+                			<pluginExecutions>
+                				<pluginExecution>
+                					<pluginExecutionFilter>
+                						<groupId>
+                							org.codehaus.mojo
+                						</groupId>
+                						<artifactId>
+                							aspectj-maven-plugin
+                						</artifactId>
+                						<versionRange>
+                							[1.3,)
+                						</versionRange>
+                						<goals>
+                							<goal>test-compile</goal>
+                							<goal>compile</goal>
+                						</goals>
+                					</pluginExecutionFilter>
+                					<action>
+                						<ignore />
+                					</action>
+                				</pluginExecution>
+                				<pluginExecution>
+                					<pluginExecutionFilter>
+                						<groupId>
+                							org.apache.maven.plugins
+                						</groupId>
+                						<artifactId>
+                							maven-antrun-plugin
+                						</artifactId>
+                						<versionRange>
+                							[1.3,)
+                						</versionRange>
+                						<goals>
+                							<goal>run</goal>
+                						</goals>
+                					</pluginExecutionFilter>
+                					<action>
+                						<ignore />
+                					</action>
+                				</pluginExecution>
+                				<pluginExecution>
+                					<pluginExecutionFilter>
+                						<groupId>
+                							org.codehaus.mojo
+                						</groupId>
+                						<artifactId>
+                							dependency-maven-plugin
+                						</artifactId>
+                						<versionRange>
+                							[1.0,)
+                						</versionRange>
+                						<goals>
+                							<goal>unpack</goal>
+                						</goals>
+                					</pluginExecutionFilter>
+                					<action>
+                						<ignore />
+                					</action>
+                				</pluginExecution>
+                			</pluginExecutions>
+                		</lifecycleMappingMetadata>
+                	</configuration>
+                </plugin>
+                <plugin>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>build-helper-maven-plugin</artifactId>
+                    <version>1.7</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>dependency-maven-plugin</artifactId>
+                    <version>1.0</version>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.0.2</version>
+                <configuration>
+                    <source>${jdk.version}</source>
+                    <target>${jdk.version}</target>
+                    <encoding>${project.build.sourceEncoding}</encoding>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.12</version>
+                <configuration>
+                    <printSummary>true</printSummary>
+                </configuration>
+            </plugin>
+            <!-- repository.apache.org doesn't accept connections from jdk 1.6 (https://issues.apache.org/jira/browse/BUILDS-85) so use toolchains
+            to require jdk 1.6 for compiling but deploy using a newer jdk
+            -->
+            <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-toolchains-plugin</artifactId>
+              <version>1.1</version>
+              <configuration>
+                <toolchains>
+                  <jdk>
+                    <version>1.6</version>
+                    <vendor>sun</vendor>
+                  </jdk>
+                </toolchains>               
+              </configuration>
+              <executions>
+                <execution>
+                  <goals>
+                    <goal>toolchain</goal>
+                  </goals>
+                </execution>
+              </executions>
+            </plugin>
+            <!-- Allow Groovy tests to run: -->
+            <plugin>
+                <groupId>org.codehaus.gmaven</groupId>
+                <artifactId>gmaven-plugin</artifactId>
+                <version>${gmaven.version}</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>compile</goal>
+                            <goal>testCompile</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <!-- Add SVN Revision To A JAR Manifest
+                     - http://maven.apache.org/plugin-developers/cookbook/add-svn-revision-to-manifest.html
+                -->
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>buildnumber-maven-plugin</artifactId>
+                <version>1.0-beta-4</version>
+                <executions>
+                    <execution>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>create</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <doCheck>false</doCheck>
+                    <doUpdate>false</doUpdate>
+                    <revisionOnScmFailure>${project.version}</revisionOnScmFailure>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>2.3.1</version>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+                        </manifest>
+                        <manifestEntries>
+                            <SCM-Revision>${buildNumber}</SCM-Revision>
+                            <SCM-url>${project.scm.url}</SCM-url>
+                        </manifestEntries>
+                    </archive>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-release-plugin</artifactId>
+                <configuration>
+                    <!-- "install" needed because we have interrelated dependencies between the modules and we are releasing them all the same - especially consider shiro-all -->
+                    <preparationGoals>clean apache-rat:check install</preparationGoals>
+                    <autoVersionSubmodules>true</autoVersionSubmodules>
+                    <!-- This configuration copied from apache:apache:7 parent pom -->
+                    <useReleaseProfile>false</useReleaseProfile>
+                    <goals>deploy site site:stage</goals>
+                    <arguments>-Pdocs,apache-release</arguments>
+                    <mavenExecutorId>forked-path</mavenExecutorId>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.sonatype.plugins</groupId>
+                <artifactId>nexus-staging-maven-plugin</artifactId>
+                <version>1.6</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <nexusUrl>https://repository.apache.org</nexusUrl>
+                    <serverId>apache.releases.https</serverId>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <!-- Automatically inherited dependencies.  The only ones that should be in here
+             are test dependencies.  Actual compile or runtime dependencies should be
+             explicitly declared in a child module, referencing the dependency defined
+             in this file's <dependencyManagement> section. -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>${junit.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymock</artifactId>
+            <version>${easymock.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <!-- Writing tests in groovy is fast!: -->
+        <dependency>
+            <groupId>org.codehaus.groovy</groupId>
+            <artifactId>groovy-all</artifactId>
+            <version>${groovy.version}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <dependencyManagement>
+        <dependencies>
+            <!-- Intra project dependencies -->
+            <dependency>
+                <groupId>org.apache.shiro</groupId>
+                <artifactId>shiro-core</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.shiro</groupId>
+                <artifactId>shiro-web</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.shiro</groupId>
+                <artifactId>shiro-ehcache</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.shiro</groupId>
+                <artifactId>shiro-quartz</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.shiro</groupId>
+                <artifactId>shiro-spring</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.shiro</groupId>
+                <artifactId>shiro-guice</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.shiro</groupId>
+                <artifactId>shiro-aspectj</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.shiro</groupId>
+                <artifactId>shiro-all</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.shiro.samples</groupId>
+                <artifactId>samples-spring-client</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+
+            <!-- Intra project test dependencies: -->
+            <dependency>
+                <groupId>org.apache.shiro</groupId>
+                <artifactId>shiro-core</artifactId>
+                <version>${project.version}</version>
+                <type>test-jar</type>
+                <scope>test</scope>
+            </dependency>
+
+            <!-- 3rd party dependencies -->
+            <dependency>
+                <!-- used for the 'hasher' command line tool: -->
+                <groupId>commons-cli</groupId>
+                <artifactId>commons-cli</artifactId>
+                <version>${commons.cli.version}</version>
+            </dependency>
+            <dependency>
+                <!-- runtime dependency for the shiro-cas module: -->
+                <groupId>commons-codec</groupId>
+                <artifactId>commons-codec</artifactId>
+                <version>${commons.codec.version}</version>
+                <scope>runtime</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.aspectj</groupId>
+                <artifactId>aspectjrt</artifactId>
+                <version>${aspectj.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.aspectj</groupId>
+                <artifactId>aspectjweaver</artifactId>
+                <version>${aspectj.version}</version>
+            </dependency>
+            <dependency>
+                <!-- Used for Atlassian Crowd Realm - not required for the framework: -->
+                <groupId>com.atlassian.crowd</groupId>
+                <artifactId>crowd-integration-client</artifactId>
+                <version>${crowd.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-api</artifactId>
+                <version>${slf4j.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-simple</artifactId>
+                <version>${slf4j.version}</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-log4j12</artifactId>
+                <version>${slf4j.version}</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <!-- Required in the sample apps only for 3rd-party libraries that expect to call
+                     the commons logging APIs -->
+                <groupId>org.slf4j</groupId>
+                <artifactId>jcl-over-slf4j</artifactId>
+                <version>${slf4j.version}</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>commons-beanutils</groupId>
+                <artifactId>commons-beanutils</artifactId>
+                <version>1.8.3</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>commons-logging</groupId>
+                        <artifactId>commons-logging</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>hsqldb</groupId>
+                <artifactId>hsqldb</artifactId>
+                <version>${hsqldb.version}</version>
+                <scope>runtime</scope>
+                <optional>true</optional>
+            </dependency>
+            <dependency>
+                <groupId>javax.servlet.jsp</groupId>
+                <artifactId>jsp-api</artifactId>
+                <version>2.1</version>
+                <scope>provided</scope>
+            </dependency>
+            <dependency>
+                <groupId>javax.servlet</groupId>
+                <artifactId>jstl</artifactId>
+                <version>1.1.2</version>
+                <scope>provided</scope>
+            </dependency>
+            <dependency>
+                <groupId>javax.servlet</groupId>
+                <artifactId>servlet-api</artifactId>
+                <version>2.5</version>
+                <scope>provided</scope>
+            </dependency>
+            <dependency>
+                <groupId>log4j</groupId>
+                <artifactId>log4j</artifactId>
+                <version>1.2.16</version>
+                <scope>test</scope>
+                <exclusions>
+                    <exclusion>
+                        <groupId>javax.mail</groupId>
+                        <artifactId>mail</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>javax.jms</groupId>
+                        <artifactId>jms</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>com.sun.jdmk</groupId>
+                        <artifactId>jmxtools</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>com.sun.jmx</groupId>
+                        <artifactId>jmxri</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>org.codehaus.groovy</groupId>
+                <artifactId>groovy-all</artifactId>
+                <version>${groovy.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>net.sf.ehcache</groupId>
+                <artifactId>ehcache-core</artifactId>
+                <version>${ehcache.version}</version>
+                <optional>true</optional>
+                <exclusions>
+                    <exclusion>
+                        <groupId>commons-logging</groupId>
+                        <artifactId>commons-logging</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <!-- Used for sample applications only - not required for the framework: -->
+                <groupId>org.hibernate</groupId>
+                <artifactId>hibernate</artifactId>
+                <version>3.2.6.ga</version>
+                <optional>true</optional>
+                <exclusions>
+                    <exclusion>
+                        <groupId>commons-logging</groupId>
+                        <artifactId>commons-logging</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>ant</groupId>
+                        <artifactId>ant</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <!--suppress MavenModelInspection -->
+                        <groupId>ant-launcher</groupId>
+                        <!--suppress MavenModelInspection -->
+                        <artifactId>ant-launcher</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>c3p0</groupId>
+                        <artifactId>c3p0</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <!--suppress MavenModelInspection -->
+                        <groupId>javax.security</groupId>
+                        <!--suppress MavenModelInspection -->
+                        <artifactId>jacc</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>javax.servlet</groupId>
+                        <artifactId>servlet-api</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>jboss</groupId>
+                        <!--suppress MavenModelInspection -->
+                        <artifactId>jboss-cache</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>net.sf.ehcache</groupId>
+                        <artifactId>ehcache</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>asm</groupId>
+                        <!--suppress MavenModelInspection -->
+                        <artifactId>asm-attrs</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>javax.transaction</groupId>
+                        <artifactId>jta</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <!-- Used to support Hibernate's JTA runtime dependency in the sample application(s) only.
+                 Not required for Shiro -->
+            <dependency>
+                <groupId>org.apache.geronimo.specs</groupId>
+                <artifactId>geronimo-jta_1.1_spec</artifactId>
+                <version>1.1.1</version>
+                <scope>runtime</scope>
+                <optional>true</optional>
+            </dependency>
+            <dependency>
+                <groupId>org.hibernate</groupId>
+                <artifactId>hibernate-annotations</artifactId>
+                <version>3.2.1.ga</version>
+                <optional>true</optional>
+            </dependency>
+            <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-context</artifactId>
+                <version>${spring.version}</version>
+                <optional>true</optional>
+                <exclusions>
+                    <exclusion>
+                        <groupId>commons-logging</groupId>
+                        <artifactId>commons-logging</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-jdbc</artifactId>
+                <version>${spring.version}</version>
+                <optional>true</optional>
+                <exclusions>
+                    <exclusion>
+                        <groupId>commons-logging</groupId>
+                        <artifactId>commons-logging</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-orm</artifactId>
+                <version>${spring.version}</version>
+                <optional>true</optional>
+                <exclusions>
+                    <exclusion>
+                        <groupId>commons-logging</groupId>
+                        <artifactId>commons-logging</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-webmvc</artifactId>
+                <version>${spring.version}</version>
+                <optional>true</optional>
+                <exclusions>
+                    <exclusion>
+                        <groupId>commons-logging</groupId>
+                        <artifactId>commons-logging</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-test</artifactId>
+                <version>${spring.version}</version>
+                <scope>test</scope>
+                <optional>true</optional>
+                <exclusions>
+                    <exclusion>
+                        <groupId>commons-logging</groupId>
+                        <artifactId>commons-logging</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+                <groupId>com.google.inject</groupId>
+                <artifactId>guice</artifactId>
+                <version>${guice.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.google.inject.extensions</groupId>
+                <artifactId>guice-multibindings</artifactId>
+                <version>${guice.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.google.inject.extensions</groupId>
+                <artifactId>guice-servlet</artifactId>
+                <version>${guice.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opensymphony.quartz</groupId>
+                <artifactId>quartz</artifactId>
+                <version>${quartz.version}</version>
+                <optional>true</optional>
+                <exclusions>
+                    <exclusion>
+                        <groupId>commons-logging</groupId>
+                        <artifactId>commons-logging</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+    
+    <!-- Note that reporting may fail with lower settings than something like: MAVEN_OPTS="-X512m -XX:MaxPermSize=128m" -->
+    <reporting>
+        <plugins>
+            <plugin>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <version>2.7</version>
+                <configuration>
+                    <source>${jdk.version}</source>
+                    <encoding>${project.build.sourceEncoding}</encoding>
+                    <linksource>true</linksource>
+                    <links>
+                        <link>http://java.sun.com/javase/6/docs/api/</link>
+                        <link>http://java.sun.com/javaee/5/docs/api/</link>
+                        <link>http://www.slf4j.org/api/</link>
+                        <link>http://static.springframework.org/spring/docs/2.5.x/api/</link>
+                        <link>http://junit.org/junit/javadoc/4.4/</link>
+                        <link>http://easymock.org/api/easymock/2.4</link>
+                        <link>http://www.quartz-scheduler.org/docs/api/1.8.0/</link>
+                    </links>
+                    <!-- Don't include the sample apps - they're not part of Shiro's API: -->
+                    <excludePackageNames>org.apache.shiro.samples.*</excludePackageNames>
+                    <top><![CDATA[
+  <!-- Begin Google Analytics code -->
+  <script type="text/javascript">
+      var _gaq = _gaq || [];
+      _gaq.push(['_setAccount', 'UA-11551827-1']);
+      _gaq.push(['_trackPageview']);
+
+      (function() {
+        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+      })();
+  </script>
+  <!-- End Google Analytics code -->
+                    ]]></top>
+                </configuration>
+                <reportSets>
+                    <reportSet>
+                        <id>javadoc-aggregate</id>
+                        <reports>
+                            <report>aggregate</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>cobertura-maven-plugin</artifactId>
+                <version>2.4</version>
+                <configuration>
+                    <formats>
+                        <format>xml</format>
+                        <format>html</format>
+                    </formats>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-jxr-plugin</artifactId>
+                <version>2.1</version>
+                <configuration>
+                    <aggregate>true</aggregate>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-pmd-plugin</artifactId>
+                <version>2.5</version>
+                <configuration>
+                    <sourceEncoding>utf-8</sourceEncoding>
+                    <targetJdk>1.5</targetJdk>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-project-info-reports-plugin</artifactId>
+                <version>2.2</version>
+                <!-- Disable, just to make it go faster -->
+                <configuration>
+                    <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <version>0.8</version>
+                <configuration>
+                		<!-- note that this configuration needs to be maintain both in pluginManagement and reporting sections -->
+                    <excludes>
+                        <exclude>**/.externalToolBuilders/*</exclude>
+                        <exclude>**/infinitest.filters</exclude>
+                        <!-- Apparently some test in samples/spring-client generates velocity log - would better to reconfigure to output to target/ -->
+                        <exclude>velocity.log</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-surefire-report-plugin</artifactId>
+                <version>2.5</version>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>taglist-maven-plugin</artifactId>
+                <version>2.4</version>
+                <configuration>
+                    <tagListOptions>
+                        <tagClasses>
+                            <tagClass>
+                                <displayName>Todo Work</displayName>
+                                <tags>
+                                    <tag>
+                                        <matchString>todo</matchString>
+                                        <matchType>ignoreCase</matchType>
+                                    </tag>
+                                    <tag>
+                                        <matchString>FIXME</matchString>
+                                        <matchType>exact</matchType>
+                                    </tag>
+                                </tags>
+                            </tagClass>
+                            <tagClass>
+                                <displayName>Deprecated</displayName>
+                                <tags>
+                                    <tag>
+                                        <matchString>@Deprecated</matchString>
+                                        <matchType>exact</matchType>
+                                    </tag>
+                                </tags>
+                            </tagClass>
+                        </tagClasses>
+                    </tagListOptions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>jdepend-maven-plugin</artifactId>
+                <version>2.0-beta-2</version>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>dashboard-maven-plugin</artifactId>
+                <version>1.0.0-beta-1</version>
+            </plugin>
+        </plugins>
+    </reporting>
+
+    <profiles>
+        <profile>
+            <id>docs</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-javadoc-plugin</artifactId>
+                        <version>2.7</version>
+                        <executions>
+                            <execution>
+                                <id>attach-api-docs</id>
+                                <goals>
+                                    <goal>jar</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                        <inherited>true</inherited>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-source-plugin</artifactId>
+                        <version>2.0.4</version>
+                        <executions>
+                            <execution>
+                                <id>attach-sources</id>
+                                <goals>
+                                    <goal>jar</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                        <inherited>true</inherited>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>apache-release</id>
+            <distributionManagement>
+                <site>
+                    <id>shiro.website</id>
+                    <name>Apache Shiro Site</name>
+                    <url>scm:svn:https://svn.apache.org/repos/asf/shiro/site/publish/static/${project.version}</url>
+                </site>
+            </distributionManagement>
+        </profile>
+    </profiles>
+</project>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/maven-repo-helper.git



More information about the pkg-java-commits mailing list