phamthaithinh / urlrewritefilter

Automatically exported from code.google.com/p/urlrewritefilter
Other
0 stars 0 forks source link

POM is unusable, dependencies are incorrent #89

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The POM is completely fucked up. You need to clean it up. All dependencies have 
incorrect scopes. Please reanalyze and read the maven documentation for 
dependency scopes.

Original issue reported on code.google.com by 1983-01...@gmx.net on 10 Mar 2011 at 9:27

GoogleCodeExporter commented 9 years ago
<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>
  <groupId>org.tuckey</groupId>
  <artifactId>urlrewrite</artifactId>
  <version>3.2.1-bac</version>

  <name>Url Rewrite Filter</name>
  <description>Based on the popular and very useful mod_rewrite for apache, UrlRewriteFilter is a Java Web Filter for any J2EE compliant web application server (such as Resin, Orion or Tomcat), which allows you to rewrite URLs before they get to your code. It is a very powerful tool just like Apache's mod_rewrite.</description>
  <url>http://www.tuckey.org/urlrewrite/</url>

      <licenses>
        <license>
            <name>BSD</name>
            <url>http://www.opensource.org/licenses/bsd-license.php</url>
        </license>
    </licenses>

    <scm>
      <url>http://code.google.com/p/urlrewritefilter/source</url>
    </scm>

   <dependencies>
      <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <!-- <version>1.3</version> -->
        <version>1.4</version>
    </dependency>

  <dependency>
    <groupId>commons-httpclient</groupId>
    <artifactId>commons-httpclient</artifactId>
    <version>3.1</version>
</dependency>

<!-- 
<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpcomponents-client</artifactId>
    <version>4.1</version>
</dependency>
-->

<dependency>
    <groupId>commons-logging</groupId>
    <artifactId>commons-logging</artifactId>
    <version>1.1.1</version>
</dependency>

<dependency>
    <groupId>org.json</groupId>
    <artifactId>json</artifactId>
    <version>20090211</version>
</dependency>

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <!--  <version>1.2.8</version> -->
    <version>1.2.16</version>
</dependency>

<!-- 
WEBLOGIC 10 error:
http://www.slf4j.org/codes.html#StaticLoggerBinder
slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or 
logback-classic.jar

<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-api</artifactId>
   <version>1.5.2</version>
  <version>1.6.1</version>
</dependency>

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.6.1</version>
</dependency>

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>0.9.27</version>
</dependency>
-->

<!--  WEBLOGIC 10 solution: -->
<dependency>
    <groupId>com.googlecode.sli4j</groupId>
    <artifactId>sli4j-slf4j-nop</artifactId>
    <version>2.0</version>
</dependency>

<dependency>
    <groupId>org.apache.ant</groupId>
    <artifactId>ant</artifactId>
    <version>1.8.2</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>org.apache.tomcat</groupId>
    <artifactId>servlet-api</artifactId>
    <!-- Servlet 2.5 and JavaServer Pages 2.1: Tomcat6/Weblogic10 -->
    <version>6.0.32</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <!--  <version>3.8.1</version> -->
     <version>3.8.2</version>
    <!--  <version>4.8.2</version> -->
    <scope>test</scope>
</dependency>

</dependencies>

 <build>
    <plugins>
          <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>clirr-maven-plugin</artifactId>
        <version>2.2.3</version>
       <!--  <version>2.3</version>  -->
        <configuration>
          <!-- Compare the current code against version 1.2 -->
          <comparisonVersion>1.5</comparisonVersion>
          <minSeverity>info</minSeverity>
           <executions>
        <execution>
          <goals>
            <goal>jar</goal>
            <goal>report</goal>
          </goals>
        </execution>
          </executions>
        </configuration>
      </plugin>
     <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <configuration>
              <source>1.5</source>
              <target>1.5</target>
              <excludes>
                   <exclude>**/*XPoint*.java</exclude>
              </excludes>
              <encoding>${project.build.sourceEncoding}</encoding>
          </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>1.4</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <filters>
                <filter>
                  <artifact>commons-codec:commons-codec</artifact>
                  <artifact>commons-httpclient:commons-httpclient</artifact>
                  <artifact>commons-logging:commons-logging</artifact>
                  <artifact>org.json:json</artifact>
                  <artifact>log4j:log4j</artifact>
                  <artifact>org.slf4j:slf4j-api</artifact>
                  <excludes>
                    <exclude>org/apache/tools/ant/**</exclude>
                    <exclude>org/apache/tools/ant/**</exclude>
                    <exclude>javax/servlet/**</exclude>
                    <exclude>org/junit/**</exclude>
                    <exclude>com/sun/**</exclude>
                  </excludes>
                </filter>
              </filters>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifestEntries>
              <title>Url Rewrite Filter</title>
              <mode>development</mode>
              <url>http://www.tuckey.org/urlrewrite/</url>
            </manifestEntries>

              <!--   <attribute name="Extension-Name" value="urlrewritefilter"/>
                <attribute name="Specification-Title" value="Url Rewrite Filter"/>
                <attribute name="Specification-Vendor" value="Paul Tuckey"/>
                <attribute name="Specification-Version" value="${app.version}"/>
                <attribute name="Implementation-Title" value="Url Rewrite Filter"/>
                <attribute name="Implementation-Vendor" value="Paul Tuckey"/>
                <attribute name="Implementation-Version" value="${app.version}"/>
                 -->
          </archive>
        </configuration>
      </plugin>
      <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <version>3.0-beta-3</version>
        </plugin>

     <!--  <plugin>
          <groupId>org.jboss.tattletale</groupId>
          <artifactId>tattletale-maven</artifactId>
          <version>1.1.1.Final</version>
          The version of the plugin you want to use
          http://repository.jboss.org/nexus/content/groups/public-jboss
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>tattletale-maven-plugin</artifactId>
           <version>1.0</version>
          <executions>
        <execution>
          <goals>
            <goal>report</goal>
          </goals>
        </execution>
          </executions>
          <configuration>
           This is the location which will be scanned for generating tattletale reports
            <source>${basedir}/src/main/java</source>
            This is where the reports will be generated
            <destination>${basedir}/target/tattletale</destination>
          </configuration>
        </plugin> -->
           <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.0-beta-2</version>
          <configuration>
            <reportPlugins>
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.7</version>
              </plugin>
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                  <aggregate>true</aggregate>
                </configuration>
              </plugin>
             <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>2.8</version>
              </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>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>2.6</version>
              </plugin>
            </reportPlugins>
          </configuration>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
            <version>2.3.2</version>
        </plugin>
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>2.5</version>
        <configuration>
          <linkXref>true</linkXref>
          <sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
          <minimumTokens>100</minimumTokens>
          <targetJdk>1.5</targetJdk>
        </configuration>
      </plugin>
    </plugins>
  </build>

    <repositories>
        <!-- Don't use snapshots unless absolutely necessary -->
        <repository>
            <id>JBoss</id>
            <name>JBoss</name>
            <url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
    </repositories>

<properties>
 <!-- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> -->
 <project.build.sourceEncoding>ISO-8859-15</project.build.sourceEncoding>
  <version>3.2.1-bac</version>
 <app.version>3.2.1-bac</app.version>
</properties>

<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.6.24</version>
          <scope>system</scope>
          <systemPath>C:\Program Files\Java\jdk1.5.0_22\lib\tools.jar</systemPath>
          <!-- <systemPath>C:\Program Files\Java\jdk1.6.0_24\lib\tools.jar</systemPath>
          <systemPath>${java.home}/../lib/tools.jar</systemPath> -->
        </dependency>
      </dependencies>
    </profile>
  </profiles>

  <!--  
  install Maven 3.0.3

  mvn install
  mvn -DskipTests=true install
  mvn dependency:tree
  mvn site
   -->

</project>

Original comment by basile.c...@ext.ec.europa.eu on 24 Mar 2011 at 10:03

GoogleCodeExporter commented 9 years ago
Still fucked up!

Proxy flag [P] supported if <a  
href="http://hc.apache.org/httpclient-3.x/">commons-httpclient</a> and  1431:   
    <a  href="http://commons.apache.org/codec/">commons-codec</a> in the 
classpath

Both aren't marked optional. Log4J and commons-logging are in compile time 
scope, why? Only SLF4J is necessary.

Dependency sli4j-slf4j is not declared.

Perform dependency:analyze and retry.

Original comment by 1983-01...@gmx.net on 24 Mar 2011 at 11:48

GoogleCodeExporter commented 9 years ago
How about you supply a working patch then instead of barking at people who are 
trying to help out.

For the record, the POM file hasn't worked since 2.6, it should have probably 
been removed since it just confuses people.

Original comment by krom...@gmail.com on 25 Mar 2011 at 8:14

GoogleCodeExporter commented 9 years ago
This would require to dump the Ant build and rely on Maven solely. Retaining 
the current awkward layout would be more disadvantage for Maven users than 
advantage.

Original comment by 1983-01...@gmx.net on 25 Mar 2011 at 9:13

GoogleCodeExporter commented 9 years ago
I've done exactly that, mostly dumped the ant build and have gone with Maven.

Please (especially you Mr "Fucked Up") verify I have it right.

See subversion for the latest version:
http://urlrewritefilter.googlecode.com/svn/trunk/pom.xml

I've done a deploy to Sonatype Staging of 4.0.1, It should be promoted to maven 
central soon.

Original comment by p...@tuckey.org on 25 Jun 2012 at 1:58

GoogleCodeExporter commented 9 years ago
The dependencies and build seem to work fine now, only I get one failure on the 
tests in UrlRewriteFilterTest.testVersion(). Perhaps this one wasn't firing 
before the move over, it seems to have been broken for a long time (requires 
0.9.0).

Original comment by krom...@gmail.com on 25 Jun 2012 at 8:24

GoogleCodeExporter commented 9 years ago
Paul, I have checked the project it seems fine but there are still some issues 
related to dependencies:

1. The Ant dep should be provided beause the task is always run within Ant and 
this is the "container".
2. SLF4J, this can be done way better. You could dynamically detect if SLF4J is 
available and use it (code available). You could completely remove SLF4J from 
the dependencies list. If SLF4J is not available I would always resort to JULI 
and always avoid sysout and syserr.

More over, there is some more point with the project which are not optimal but 
this is out of the scope of this ticket.

Original comment by 1983-01...@gmx.net on 25 Jun 2012 at 10:16

GoogleCodeExporter commented 9 years ago
Agreed on ant, missed that.

For slf4j-api you need a dependency to be able to compile, so I'm not entirely 
sure how you intend to remove it from the dependencies. Unless you mean to use 
introspection, but why bother? You could mark it provided, since it's only a 
compile-time dependency, unless the client configures the filter to use it, in 
which case he's supposed to be providing it. I see little to no semantic 
differences with marking it optional though.

Other projects often seem to depend outright on their version and expect the 
client to deal with version issues (basically you pin slf4j-api). Either way it 
will lead to some confusion the first time someone tries to set up slf4j 
logging.

Original comment by krom...@gmail.com on 25 Jun 2012 at 11:20

GoogleCodeExporter commented 9 years ago
Let me restructure 2:

SLF4J, this can be done way better. If SLF4J is not available I would always 
resort to JULI and always avoid sysout and syserr.

No retrospection involded. Scope can remain compile with optional 'true'. A 
simple Class#forName would reveal if SLF4J is available and continue using 
SLF4J. See this as an example from DisplayTag: 
http://www.displaytag.org/1.2/displaytag/xref/org/displaytag/util/DependencyChec
ker.html#45

Original comment by 1983-01...@gmx.net on 25 Jun 2012 at 3:09

GoogleCodeExporter commented 9 years ago
Though I don't understand why the project is still Ant-structured. If you go 
with Maven, use its conventions.

Original comment by 1983-01...@gmx.net on 25 Jun 2012 at 3:10

GoogleCodeExporter commented 9 years ago
I was replying to:
"You could completely remove SLF4J from the dependencies list."

It needs to be in the dependencies list, no matter how you detect it's there.

Original comment by krom...@gmail.com on 26 Jun 2012 at 7:22

GoogleCodeExporter commented 9 years ago
I know that, that's why I rewrote my second comment. The dependency has to 
remain but the Java code can be improved.

Original comment by 1983-01...@gmx.net on 26 Jun 2012 at 11:02

GoogleCodeExporter commented 9 years ago
Hi,

- UrlRewriteFilterTest.testVersion fixed. 
- ant dependency marked as provided.

I know what you are getting at about SLF4J.  Making it optional is good enough 
though right?  Default logging is to the servlet context and only change to 
SLF4j, stdout or stderr if a user configures it to.

I intend to remove the ant build script eventually.

Original comment by p...@tuckey.org on 29 Jun 2012 at 3:00

GoogleCodeExporter commented 9 years ago
I still have build failures:

org.tuckey.web.filters.urlrewrite.Condition DEBUG: evaluating with operator, is 
9001  9001
org.tuckey.web.filters.urlrewrite.Condition ERROR: Condition 0 had error: Value 
aaa is not a valid number (tried to cast to java type long)
org.tuckey.web.filters.urlrewrite.Condition DEBUG: loaded condition port null 
aaa
org.tuckey.web.filters.urlrewrite.Condition DEBUG: condition not valid skipping
Tests run: 56, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.027 sec

Results :

Failed tests:   
testVersion(org.tuckey.web.filters.urlrewrite.UrlRewriteFilterTest): Ver bad 
null build 1

Tests run: 229, Failures: 1, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.

Please refer to 
/.amd_mnt/blnn728x/home/osipovmi/Projekte/urlrewritefilter/target/surefire-repor
ts for the individual test results.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5 seconds
[INFO] Finished at: 2012-06-29 11:24:16
[INFO] Final Memory: 25M/60M
[INFO] ------------------------------------------------------------------------

Optional is fine. But does is it really necessary to make log to stdout/err 
avaiable? ServletContext is always there. Logging to std streams is considered 
bad practice.

If you remove the build.xml - which I would favor - please restructure the 
directories to Maven conventions.

Original comment by 1983-01...@gmx.net on 29 Jun 2012 at 9:26

GoogleCodeExporter commented 9 years ago
Hi,

Yes, I do intend to remove the ant build and restructure the directories.  

I only got one of those errors (version number). It is fixed now on trunk.

Can you confirm that you are running from trunk and doing a "mvn clean test"?

Thanks
Paul

Original comment by p...@tuckey.org on 29 Jun 2012 at 10:20

GoogleCodeExporter commented 9 years ago
Thank you, Paul. Tests work for me now.

Original comment by krom...@gmail.com on 30 Jun 2012 at 4:59

GoogleCodeExporter commented 9 years ago
Paul, works like a charm now. Though there are some points with the point which 
can improve the overall build experience. if you are interested, I can open 
another issue for that.

Original comment by 1983-01...@gmx.net on 1 Jul 2012 at 12:02

GoogleCodeExporter commented 9 years ago
Yes please.

I am keen to make it as simple as possible.

Original comment by p...@tuckey.org on 2 Jul 2012 at 10:23