Changeset 4150
- Timestamp:
- 01/07/08 04:33:38 (5 years ago)
- Location:
- lang/java/mvnbeans/trunk
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/java/mvnbeans/trunk
-
Property
svn:ignore set
to
target
-
Property
svn:ignore set
to
-
lang/java/mvnbeans/trunk/pom.xml
r3199 r4150 27 27 <source>1.5</source> 28 28 <target>1.5</target> 29 <encoding>UTF-8</encoding> 30 </configuration> 31 </plugin> 32 <plugin> 33 <artifactId>maven-resources-plugin</artifactId> 34 <version>RELEASE</version> 35 <configuration> 36 <encoding>UTF-8</encoding> 29 37 </configuration> 30 38 </plugin> -
lang/java/mvnbeans/trunk/src/main/java/jp/javelindev/mvnbeans/App.java
r3199 r4150 7 7 import java.io.InputStream; 8 8 import java.nio.channels.Channels; 9 import java.util.ArrayList; 9 10 import java.util.EnumSet; 11 import java.util.HashSet; 10 12 import java.util.List; 13 import java.util.Set; 11 14 import java.util.logging.Level; 12 15 import java.util.logging.Logger; … … 105 108 switch(cmd) { 106 109 case FETCH: 107 fetchAllArtifact(artifact, 0 );110 fetchAllArtifact(artifact, 0, null); 108 111 break; 109 112 case SEARCH: … … 136 139 } 137 140 138 static void fetchAllArtifact(Artifact artifact, int count) throws RepositoryIOException, IOException { 141 static void fetchAllArtifact(Artifact artifact, int count, Set<Artifact> reserved) throws RepositoryIOException, IOException { 142 Set<Artifact> reservedArtifacts = null; 143 if(reserved == null) { 144 reservedArtifacts = new HashSet<Artifact>(); 145 } else { 146 reservedArtifacts = reserved; 147 } 148 139 149 String fileName = artifact.getArtifactId() + "-" + artifact.getVersion() + ".jar"; 140 150 File artifactFile = new File(fileName); … … 143 153 if(artifactFile.exists()) { 144 154 System.out.println(repeatString("--", count) + "> " + fileName + "...already exists."); 155 } else if(reservedArtifacts.contains(artifact)) { 156 //the artifact is already reserved for downloading. 157 System.out.println(repeatString("--", count) + "> " + fileName + "...is already reserved for downloading."); 145 158 } else { 146 159 … … 150 163 if(deps.size() > 0) { 151 164 System.out.println(repeatString("--", count) + "> processing " + fileName + "(" + artifact.getFileURL() + ")..."); 165 166 //the artifact has some dependencies, so we can not download the artifact just now 167 //and need to wait until the end of downloading of all the dependencies. 168 //the artifact will be download after downloading the dependencies, 169 //we hold the instance into our reminder cache. 170 reservedArtifacts.add(artifact); 152 171 } else { 153 172 System.out.print(repeatString("--", count) + "> processing " + fileName + "(" + artifact.getFileURL() + ")..."); … … 156 175 //download all the dependencies. 157 176 for (Artifact dependency : artifact.getDependencies()) { 158 fetchAllArtifact(dependency, count + 1 );177 fetchAllArtifact(dependency, count + 1, reserved); 159 178 } 160 179 … … 183 202 if(deps.size() > 0) { 184 203 System.out.println(repeatString("--", count) + "> end."); 204 205 //finally we have download the artifact. 206 //remove the instance from our reminder cache. 207 reservedArtifacts.remove(artifact); 185 208 } else { 186 209 System.out.println("end.");
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)