Skip to content

Commit

Permalink
outputFile
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo committed Dec 4, 2024
1 parent 9ce326e commit 54c1268
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/it/projects/mdep-839-list/invoker.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# specific language governing permissions and limitations
# under the License.

invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:list --Doutput-file="/tmp/temp.txt"
invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:list
19 changes: 19 additions & 0 deletions src/it/projects/mdep-839-list/test.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 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.

outputFile = classpath.txt

4 changes: 2 additions & 2 deletions src/it/projects/mdep-839-list/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* under the License.
*/

File file = new File( basedir, "/tmp/temp.txt" )
assert file.exists()
File file = new File( basedir, "classpath.txt" )
assert file.exists() : "output file $file does not exist"

String output = file.getText( "UTF-8" )
assert output.contains( 'The following files have been resolved:')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.Objects;

Expand Down Expand Up @@ -229,7 +230,8 @@ public static synchronized void write(String string, File file, boolean append,
*/
public static synchronized void write(String string, File file, boolean append, String encoding)
throws IOException {
Files.createDirectories(file.getParentFile().toPath());
Path parent = Files.createDirectories(file.getParentFile().toPath());
System.err.println(parent.toAbsolutePath());

OpenOption appendOption = append ? StandardOpenOption.APPEND : StandardOpenOption.TRUNCATE_EXISTING;

Expand Down

0 comments on commit 54c1268

Please sign in to comment.