Author: baerrach
Date: Wed Dec 10 15:06:32 2008
New Revision: 725481

URL: http://svn.apache.org/viewvc?rev=725481&view=rev
Log:
[MECLIPSE-504] Add a new mojo eclipse:remove-cache
Added forceRecheck to AbstractIdeSupportMojo which will recheck 
sources/javadocs for existence. 

Added:
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/expected/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/expected/.classpath
   (with props)
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/expected/.project
   (with props)
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/pom.xml
   (with props)
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/main/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/main/java/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/main/java/DummyClass.txt
   (with props)
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/main/resources/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/main/resources/dummy
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/test/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/test/java/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/test/java/DummyClass.txt
   (with props)
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/test/resources/
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/test/resources/dummy
Modified:
    
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
    
maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/ide/messages.properties
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java

Modified: 
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java?rev=725481&r1=725480&r2=725481&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
 Wed Dec 10 15:06:32 2008
@@ -190,8 +190,8 @@
     /**
      * Enables/disables the downloading of source attachments. Defaults to 
false. When this flag is <code>true</code>
      * remote repositories are checked for sources: in order to avoid repeated 
check for unavailable source archives, a
-     * status cache is mantained in the ~/.m2 directory. To reset this cache 
delete the 
-     * <code>maven-eclipse-plugin-cache.properties</code>.
+     * status cache is mantained. To reset this cache run <code>mvn 
eclipse:remove-cache</code>, or use the
+     * <code>forceRecheck</code> option.
      * 
      * @parameter expression="${downloadSources}"
      */
@@ -200,12 +200,22 @@
     /**
      * Enables/disables the downloading of javadoc attachments. Defaults to 
false. When this flag is <code>true</code>
      * remote repositories are checked for javadocs: in order to avoid 
repeated check for unavailable javadoc archives,
-     * a status cache is mantained in the ~/.m2 directory. To reset this cache 
delete the 
-     * <code>maven-eclipse-plugin-cache.properties</code>.
+     * a status cache is mantained. To reset this cache run <code>mvn 
eclipse:remove-cache</code>, or use the
+     * <code>forceRecheck</code> option.
      * 
      * @parameter expression="${downloadJavadocs}"
      */
     protected boolean downloadJavadocs;
+    
+    /**
+     * Enables/disables the rechecking of the remote repository for 
downloading source/javadoc attachments. Defaults to
+     * false. When this flag is <code>true</code> and the source or javadoc 
attachment has a status cache to indicate
+     * that it is not available, then the remote repository will be rechecked 
for a source or javadoc attachment and the
+     * status cache updated to reflect the new state.
+     * 
+     * @parameter expression="${forceRecheck}"
+     */
+    protected boolean forceRecheck;
 
     /**
      * Plexus logger needed for debugging manual artifact resolution.
@@ -939,6 +949,12 @@
                                                        inClassifier, 
artifactFactory );
             File notAvailableMarkerFile = IdeUtils.getNotAvailableMarkerFile( 
localRepository, artifact );
 
+            if (forceRecheck && notAvailableMarkerFile.exists()) {
+                if (!notAvailableMarkerFile.delete()) {
+                    getLog().warn( Messages.getString( 
"unabletodeletenotavailablemarkerfile", notAvailableMarkerFile ) );
+                }
+            }
+            
             if ( !notAvailableMarkerFile.exists() )
             {                
                 artifact =

Modified: 
maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/ide/messages.properties
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/ide/messages.properties?rev=725481&r1=725480&r2=725481&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/ide/messages.properties
 (original)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/ide/messages.properties
 Wed Dec 10 15:06:32 2008
@@ -11,3 +11,4 @@
 unabletoparseversion={0}: unable to parse version ''{1}'' for dependency 
''{2}'': {3}
 failedtocreatenotavailablemarkerfile=Error creating not available file {0}
 creatednotavailablemarkerfile=Not available marker file created: {0}
+unabletodeletenotavailablemarkerfile=Unable to delete marker file: {0}
\ No newline at end of file

Modified: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java?rev=725481&r1=725480&r2=725481&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java
 (original)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java
 Wed Dec 10 15:06:32 2008
@@ -587,7 +587,25 @@
         assertNotAvailableMarkerFileDoesNotExist( "does-not-exist", 
"does-not-exist", "666", null, "sources" );
         assertNotAvailableMarkerFileDoesNotExist( "does-not-exist", 
"does-not-exist", "666", null, "javadoc" );
     }    
-    
+
+    /**
+     * Test forceRecheck
+     * 
+     * @throws Exception
+     */
+    public void testProject49()
+        throws Exception
+    {
+        File notAvailableMarkerFile =
+            getNotAvailableMarkerFile( "commons-lang", "commons-lang", "2.4", 
null, "sources" );
+        notAvailableMarkerFile.getParentFile().mkdirs();
+        notAvailableMarkerFile.createNewFile();
+        getNotAvailableMarkerFile( "commons-lang", "commons-lang", "2.4", 
null, "javadoc" ).createNewFile();
+
+        testProject( "project-49" );
+        assertNotAvailableMarkerFileDoesNotExist( "commons-lang", 
"commons-lang", "2.4", null, "sources" );
+        assertNotAvailableMarkerFileDoesNotExist( "commons-lang", 
"commons-lang", "2.4", null, "javadoc" );
+    }   
     
     public void testJeeSimple()
         throws Exception

Added: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/expected/.classpath
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/expected/.classpath?rev=725481&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/expected/.classpath
 (added)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/expected/.classpath
 Wed Dec 10 15:06:32 2008
@@ -0,0 +1,13 @@
+<classpath>
+  <classpathentry kind="src" path="src/test/java" output="target/test-classes" 
including="**/*.java"/>
+  <classpathentry kind="src" path="src/test/resources" 
output="target/test-classes" excluding="**/*.java"/>
+  <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
+  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="var" 
path="M2_REPO/commons-lang/commons-lang/2.4/commons-lang-2.4.jar" 
sourcepath="M2_REPO/commons-lang/commons-lang/2.4/commons-lang-2.4-sources.jar">
+    <attributes>
+      <attribute 
value="jar:file:${M2_REPO}/commons-lang/commons-lang/2.4/commons-lang-2.4-javadoc.jar!/"
 name="javadoc_location"/>
+    </attributes>
+  </classpathentry>
+</classpath>
\ No newline at end of file

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/expected/.classpath
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/expected/.project
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/expected/.project?rev=725481&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/expected/.project
 (added)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/expected/.project
 Wed Dec 10 15:06:32 2008
@@ -0,0 +1,13 @@
+<projectDescription>
+  <name>maven-eclipse-plugin-test-project-49</name>
+  <comment>Test forceRecheck</comment>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/expected/.project
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/pom.xml?rev=725481&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/pom.xml
 Wed Dec 10 15:06:32 2008
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>eclipse</groupId>
+  <artifactId>maven-eclipse-plugin-test-project-49</artifactId>
+  <version>88.0</version>
+  <name>Maven</name>
+  <description>Test forceRecheck</description>
+  <dependencies>
+    <!-- sources and javadocs really exist for this artifact -->
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.4</version>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-eclipse-plugin</artifactId>
+        <version>test</version>
+        <configuration>
+          <downloadSources>true</downloadSources>
+          <downloadJavadocs>true</downloadJavadocs>
+          <forceRecheck>true</forceRecheck>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/main/java/DummyClass.txt
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/main/java/DummyClass.txt?rev=725481&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/main/java/DummyClass.txt
 (added)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/main/java/DummyClass.txt
 Wed Dec 10 15:06:32 2008
@@ -0,0 +1,7 @@
+/**
+ * @author <a href="mailto:[EMAIL PROTECTED]">Trygve Laugst&oslash;l</a>
+ * @version $Id: DummyClass.txt 359507 2005-12-28 13:14:19Z fgiust $
+ */
+public class DummyClass
+{
+}

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/main/java/DummyClass.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/main/resources/dummy
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/main/resources/dummy?rev=725481&view=auto
==============================================================================
    (empty)

Added: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/test/java/DummyClass.txt
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/test/java/DummyClass.txt?rev=725481&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/test/java/DummyClass.txt
 (added)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/test/java/DummyClass.txt
 Wed Dec 10 15:06:32 2008
@@ -0,0 +1,7 @@
+/**
+ * @author <a href="mailto:[EMAIL PROTECTED]">Trygve Laugst&oslash;l</a>
+ * @version $Id: DummyClass.txt 422434 2006-07-16 12:41:38Z fgiust $
+ */
+public class DummyClass
+{
+}

Propchange: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/test/java/DummyClass.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/test/resources/dummy
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-49/src/test/resources/dummy?rev=725481&view=auto
==============================================================================
    (empty)


Reply via email to