mbien commented on code in PR #378: URL: https://github.com/apache/netbeans-mavenutils-nbm-maven-plugin/pull/378#discussion_r4713936422
########## nbm-maven-plugin/src/main/java/org/apache/netbeans/nbm/MavenInfraUtils.java: ########## @@ -0,0 +1,47 @@ +/* + * Copyright 2026 The Apache Software Foundation. + * + * Licensed 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. + */ +package org.apache.netbeans.nbm; + +import java.io.File; +import java.util.List; +import java.util.Set; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.archiver.Archiver; +import org.codehaus.plexus.archiver.FileSet; +import org.codehaus.plexus.archiver.util.DefaultFileSet; + +public class MavenInfraUtils { + + private MavenInfraUtils() { + // utility class + } + + /** + * replace addDirectory to addFileSet in plexus archiver will be removed + */ + static FileSet getFileSet(File jarDirectory, Archiver archiver, String[] includes, String[] excludes) { + return DefaultFileSet.fileSet(jarDirectory).prefixed("").includeExclude(includes, excludes).includeEmptyDirs(archiver.getIncludeEmptyDirs()); + } + + static List<Artifact> getRuntimeArtifacts(MavenProject project) { + return project.getRuntimeArtifacts(); + } + + static Set<Artifact> getDependencArtifacts(MavenProject project) { Review Comment: missing `y` ########## nbm-maven-plugin/src/main/java/org/apache/netbeans/nbm/MavenInfraUtils.java: ########## @@ -0,0 +1,47 @@ +/* + * Copyright 2026 The Apache Software Foundation. + * + * Licensed 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. + */ +package org.apache.netbeans.nbm; + +import java.io.File; +import java.util.List; +import java.util.Set; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.archiver.Archiver; +import org.codehaus.plexus.archiver.FileSet; +import org.codehaus.plexus.archiver.util.DefaultFileSet; + +public class MavenInfraUtils { + + private MavenInfraUtils() { + // utility class + } + + /** + * replace addDirectory to addFileSet in plexus archiver will be removed Review Comment: a word or a `,` might be missing somewhere. I asked a bot to generate javadoc if you want to take that, typo is also fixed: ```java /** * Builds a {@link FileSet} over the given directory. * * <p>Entry names stay relative to {@code jarDirectory} (empty prefix). * Optional Ant-style include/exclude path patterns are applied by the * directory scanner; empty directories are included or skipped according * to the archiver's {@code includeEmptyDirs} setting.</p> * * @param jarDirectory base directory to scan * @param archiver the archiver this file set is added to, used for * its {@code includeEmptyDirs} setting * @param includes Ant-style include patterns, or {@code null} to * include all files * @param excludes Ant-style exclude patterns, or {@code null} for none * @return a {@link FileSet} covering {@code jarDirectory} */ static FileSet getFileSet(File jarDirectory, Archiver archiver, String[] includes, String[] excludes) and for the two artifact helpers (mirroring what they delegate to, no history): /** * Returns this project's dependency artifacts in all scopes, including * transitive dependencies. */ static Set<Artifact> getDependencyArtifacts(MavenProject project) /** * Returns this project's runtime-scope dependencies (compile + runtime), * including transitive dependencies, as a list of artifacts. */ static List<Artifact> getRuntimeArtifacts(MavenProject project) ``` ########## nbm-maven-plugin/src/main/java/org/apache/netbeans/nbm/CreateWebstartAppMojo.java: ########## @@ -482,17 +481,18 @@ public boolean isSymbolicLink() { archiver.addResource(new PlexusIoResource() { public @Override InputStream getContents() throws IOException { - return new ByteArrayInputStream(("" - + "<web-app>\n" - + " <servlet>\n" - + " <servlet-name>JnlpDownloadServlet</servlet-name>\n" - + " <servlet-class>jnlp.sample.servlet.JnlpDownloadServlet</servlet-class>\n" - + " </servlet>\n" - + " <servlet-mapping>\n" - + " <servlet-name>JnlpDownloadServlet</servlet-name>\n" - + " <url-pattern>*.jnlp</url-pattern>\n" - + " </servlet-mapping>\n" - + "</web-app>\n").getBytes()); + return new ByteArrayInputStream((""" + <web-app> + <servlet> + <servlet-name>JnlpDownloadServlet</servlet-name> + <servlet-class>jnlp.sample.servlet.JnlpDownloadServlet</servlet-class> + </servlet> + <servlet-mapping> + <servlet-name>JnlpDownloadServlet</servlet-name> + <url-pattern>*.jnlp</url-pattern> + </servlet-mapping> + </web-app> + """).getBytes()); Review Comment: forgot what version the lower bound is, but `StandardCharsets.UTF_8` might not hurt here. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
