@@ -86,11 +86,11 @@ public Jpm build() {
8686 *
8787 * @param artifactNames The artifacts to copy.
8888 * @param sync Whether to sync the target directory or not.
89- * @return An instance of {@link SyncStats } containing the statistics of the copy operation.
89+ * @return An instance of {@link SyncResult } containing the statistics of the copy operation.
9090 * @throws IOException If an error occurred during the copy operation.
9191 * @throws DependencyResolutionException If an error occurred during the dependency resolution.
9292 */
93- public SyncStats copy (String [] artifactNames , boolean sync )
93+ public SyncResult copy (String [] artifactNames , boolean sync )
9494 throws IOException , DependencyResolutionException {
9595 return copy (artifactNames , Collections .emptyMap (), sync );
9696 }
@@ -101,11 +101,11 @@ public SyncStats copy(String[] artifactNames, boolean sync)
101101 * @param artifactNames The artifacts to copy.
102102 * @param repos A map of additional repository names to URLs where artifacts can be found.
103103 * @param sync Whether to sync the target directory or not.
104- * @return An instance of {@link SyncStats } containing the statistics of the copy operation.
104+ * @return An instance of {@link SyncResult } containing the statistics of the copy operation.
105105 * @throws IOException If an error occurred during the copy operation.
106106 * @throws DependencyResolutionException If an error occurred during the dependency resolution.
107107 */
108- public SyncStats copy (String [] artifactNames , Map <String , String > repos , boolean sync )
108+ public SyncResult copy (String [] artifactNames , Map <String , String > repos , boolean sync )
109109 throws IOException , DependencyResolutionException {
110110 List <Path > files = Resolver .create (artifactNames , repos ).resolvePaths ();
111111 return FileUtils .syncArtifacts (files , directory , noLinks , !sync );
@@ -141,11 +141,11 @@ private static String artifactGav(Artifact artifact) {
141141 * basically means sync-copying the artifacts to the target directory.
142142 *
143143 * @param artifactNames The artifacts to install.
144- * @return An instance of {@link SyncStats } containing the statistics of the install operation.
144+ * @return An instance of {@link SyncResult } containing the statistics of the install operation.
145145 * @throws IOException If an error occurred during the install operation.
146146 * @throws DependencyResolutionException If an error occurred during the dependency resolution.
147147 */
148- public SyncStats install (String [] artifactNames )
148+ public SyncResult install (String [] artifactNames )
149149 throws IOException , DependencyResolutionException {
150150 return install (artifactNames , Collections .emptyMap ());
151151 }
@@ -158,18 +158,18 @@ public SyncStats install(String[] artifactNames)
158158 *
159159 * @param artifactNames The artifacts to install.
160160 * @param extraRepos A map of additional repository names to URLs where artifacts can be found.
161- * @return An instance of {@link SyncStats } containing the statistics of the install operation.
161+ * @return An instance of {@link SyncResult } containing the statistics of the install operation.
162162 * @throws IOException If an error occurred during the install operation.
163163 * @throws DependencyResolutionException If an error occurred during the dependency resolution.
164164 */
165- public SyncStats install (String [] artifactNames , Map <String , String > extraRepos )
165+ public SyncResult install (String [] artifactNames , Map <String , String > extraRepos )
166166 throws IOException , DependencyResolutionException {
167167 AppInfo appInfo = AppInfo .read ();
168168 String [] artifacts = getArtifacts (artifactNames , appInfo );
169169 Map <String , String > repos = getRepositories (extraRepos , appInfo );
170170 if (artifacts .length > 0 ) {
171171 List <Path > files = Resolver .create (artifacts , repos ).resolvePaths ();
172- SyncStats stats = FileUtils .syncArtifacts (files , directory , noLinks , true );
172+ SyncResult stats = FileUtils .syncArtifacts (files , directory , noLinks , true );
173173 if (artifactNames .length > 0 ) {
174174 for (String dep : artifactNames ) {
175175 int p = dep .lastIndexOf (':' );
@@ -182,7 +182,7 @@ public SyncStats install(String[] artifactNames, Map<String, String> extraRepos)
182182 }
183183 return stats ;
184184 } else {
185- return new SyncStats ();
185+ return new SyncResult ();
186186 }
187187 }
188188
@@ -216,7 +216,13 @@ public List<Path> path(String[] artifactNames, Map<String, String> extraRepos)
216216 String [] deps = getArtifacts (artifactNames , appInfo );
217217 Map <String , String > repos = getRepositories (extraRepos , appInfo );
218218 if (deps .length > 0 ) {
219- return Resolver .create (deps , repos ).resolvePaths ();
219+ List <Path > files = Resolver .create (deps , repos ).resolvePaths ();
220+ if (artifactNames .length > 0 ) {
221+ return files ;
222+ } else {
223+ SyncResult result = FileUtils .syncArtifacts (files , directory , noLinks , true );
224+ return result .files ;
225+ }
220226 } else {
221227 return Collections .emptyList ();
222228 }
0 commit comments