[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17767909#comment-17767909 ] ASF GitHub Bot commented on MNG-7820: - gnodet merged PR #1255: URL: https://github.com/apache/maven/pull/1255 > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Assignee: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17767848#comment-17767848 ] ASF GitHub Bot commented on MNG-7820: - gnodet opened a new pull request, #1255: URL: https://github.com/apache/maven/pull/1255 JIRA issue: http://issues.apache.org/jira/browse/MNG-7820 Follow up on #1249, #1250 and #1251 > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17767838#comment-17767838 ] ASF GitHub Bot commented on MNG-7820: - gnodet merged PR #1251: URL: https://github.com/apache/maven/pull/1251 > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17767837#comment-17767837 ] ASF GitHub Bot commented on MNG-7820: - gnodet merged PR #1250: URL: https://github.com/apache/maven/pull/1250 > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17767836#comment-17767836 ] ASF GitHub Bot commented on MNG-7820: - gnodet merged PR #1249: URL: https://github.com/apache/maven/pull/1249 > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17766322#comment-17766322 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1244: URL: https://github.com/apache/maven/pull/1244#discussion_r1328543020 ## maven-model-builder/src/main/java/org/apache/maven/utils/Os.java: ## @@ -0,0 +1,213 @@ +/* + * 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. + */ +package org.apache.maven.utils; + +import java.util.Locale; +import java.util.stream.Stream; + +/** + * OS support + */ +public class Os { Review Comment: @michael-o @elharo so I don't really understand what you both want / imply. Could you be more specific please? > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17766320#comment-17766320 ] ASF GitHub Bot commented on MNG-7820: - elharo commented on code in PR #1244: URL: https://github.com/apache/maven/pull/1244#discussion_r1328539508 ## maven-model-builder/src/main/java/org/apache/maven/utils/Os.java: ## @@ -0,0 +1,213 @@ +/* + * 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. + */ +package org.apache.maven.utils; + +import java.util.Locale; +import java.util.stream.Stream; + +/** + * OS support + */ +public class Os { Review Comment: Yes, we do, but one thing at a time. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17766202#comment-17766202 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1244: URL: https://github.com/apache/maven/pull/1244#discussion_r1328253129 ## maven-model-builder/src/main/java/org/apache/maven/utils/Os.java: ## @@ -0,0 +1,213 @@ +/* + * 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. + */ +package org.apache.maven.utils; + +import java.util.Locale; +import java.util.stream.Stream; + +/** + * OS support + */ +public class Os { Review Comment: Well, the point is to get rid of plexus-utils, so we need a replacement for that one too. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17765708#comment-17765708 ] ASF GitHub Bot commented on MNG-7820: - michael-o commented on code in PR #1244: URL: https://github.com/apache/maven/pull/1244#discussion_r1327501134 ## maven-model-builder/src/main/java/org/apache/maven/utils/Os.java: ## @@ -0,0 +1,213 @@ +/* + * 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. + */ +package org.apache.maven.utils; + +import java.util.Locale; +import java.util.stream.Stream; + +/** + * OS support + */ +public class Os { Review Comment: Would it make sense to skip this class? > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17765223#comment-17765223 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on PR #1244: URL: https://github.com/apache/maven/pull/1244#issuecomment-1719636744 > > still appears to violate Apache rules on inclusion of third party code > > I disagree for the following reasons: > > * `MethodMap`, `ClassMap` and `ReflectionValueExtractor` [come from the ASF](https://github.com/codehaus-plexus/plexus-utils/commit/1325c3d2de75da489539cd5f9c6e89bdcfb92c25), [originally in Maven Core](https://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/util/introspection/?pathrev=163742) and have not undergone major modifications since > * the `Xpp3PerfTest` has been written by me, so I hereby donate it to the ASF > * the `Os` and `DAG` (now `Graph`) have been rewritten @elharo I've raised https://issues.apache.org/jira/browse/LEGAL-655 > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17765143#comment-17765143 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on PR #1244: URL: https://github.com/apache/maven/pull/1244#issuecomment-1719328165 > still appears to violate Apache rules on inclusion of third party code I disagree for the following reasons: * `MethodMap`, `ClassMap` and `ReflectionValueExtractor` [come from the ASF](https://github.com/codehaus-plexus/plexus-utils/commit/1325c3d2de75da489539cd5f9c6e89bdcfb92c25), [originally in Maven Core](https://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/util/introspection/?pathrev=163742) and have not undergone major modifications since * the `Xpp3PerfTest` has been written by me, so I hereby donate it to the ASF * the `Os` and `DAG` (now `Graph`) have been rewritten > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17765129#comment-17765129 ] ASF GitHub Bot commented on MNG-7820: - gnodet merged PR #1243: URL: https://github.com/apache/maven/pull/1243 > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17765107#comment-17765107 ] ASF GitHub Bot commented on MNG-7820: - elharo commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1325782731 ## maven-model/src/test/java/org/apache/maven/model/v4/Xpp3DomPerfTest.java: ## @@ -18,22 +18,6 @@ */ package org.apache.maven.model.v4; -/* Review Comment: Possibly you can ask at https://issues.apache.org/jira/projects/LEGAL/issues/LEGAL-654?filter=allopenissues I'm fine with whatever they say is fine. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17765104#comment-17765104 ] ASF GitHub Bot commented on MNG-7820: - elharo commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1325779523 ## maven-model/src/test/java/org/apache/maven/model/v4/Xpp3DomPerfTest.java: ## @@ -18,22 +18,6 @@ */ package org.apache.maven.model.v4; -/* Review Comment: We need a lawyer, or at least official approval. This is complicated and Apache is rigorous about crossing the t's and dotting the I's. IANAL and cannot decide on who owns what or what rules apply where outside the common cases, and this one is getting increasingly wonky. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17765100#comment-17765100 ] ASF GitHub Bot commented on MNG-7820: - elharo commented on code in PR #1244: URL: https://github.com/apache/maven/pull/1244#discussion_r1325767509 ## maven-core/src/main/java/org/apache/maven/plugin/MethodMap.java: ## @@ -0,0 +1,395 @@ +/* + * 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. + */ +package org.apache.maven.plugin; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +class MethodMap { +private static final int MORE_SPECIFIC = 0; + +private static final int LESS_SPECIFIC = 1; + +private static final int INCOMPARABLE = 2; + +/** + * Keep track of all methods with the same name. + */ +Map> methodByNameMap = new Hashtable<>(); + +/** + * Add a method to a list of methods by name. For a particular class we are keeping track of all the methods with + * the same name. + * + * @param method The method + */ +public void add(Method method) { +String methodName = method.getName(); + +List l = get(methodName); Review Comment: l --> list In general, avoid abbreviations and especially avoid the single letter L which is confusable with the digit one in many fonts > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17765056#comment-17765056 ] ASF GitHub Bot commented on MNG-7820: - gnodet closed pull request #1208: [MNG-7820] Remove dependency on plexus-utils URL: https://github.com/apache/maven/pull/1208 > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17765054#comment-17765054 ] ASF GitHub Bot commented on MNG-7820: - gnodet opened a new pull request, #1244: URL: https://github.com/apache/maven/pull/1244 On top of #1243, supersedes #1208 - [MNG-7820] Remove dependency on plexus-utils StringUtils / FileUtils - [MNG-7820] Get rid of plexus-utils Os, DAG and ReflectionValueExtractor > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17765055#comment-17765055 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on PR #1208: URL: https://github.com/apache/maven/pull/1208#issuecomment-1718991448 Superseded by #1243 and #1244. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17765052#comment-17765052 ] ASF GitHub Bot commented on MNG-7820: - gnodet opened a new pull request, #1243: URL: https://github.com/apache/maven/pull/1243 Split out of https://github.com/apache/maven/pull/1208 > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17764712#comment-17764712 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1324600451 ## maven-model/src/test/java/org/apache/maven/model/v4/Xpp3DomPerfTest.java: ## @@ -18,22 +18,6 @@ */ package org.apache.maven.model.v4; -/* Review Comment: I am the author and owner of this file, so I gave it to Codehaus, but now I'm giving it to the ASF. So the pointer you gave does not apply here because it's *not* a _third-party source file_. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17764710#comment-17764710 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1324600451 ## maven-model/src/test/java/org/apache/maven/model/v4/Xpp3DomPerfTest.java: ## @@ -18,22 +18,6 @@ */ package org.apache.maven.model.v4; -/* Review Comment: I am the author and owner of this file, so I gave it to Codehaus, but now I'm giving it to the ASF. So the pointer you gave does not apply here. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17764638#comment-17764638 ] ASF GitHub Bot commented on MNG-7820: - elharo commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1324435432 ## maven-core/src/main/java/org/apache/maven/plugin/ReflectionValueExtractor.java: ## @@ -0,0 +1,303 @@ +/* + * 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. + */ +package org.apache.maven.plugin; + +import java.lang.ref.WeakReference; +import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; +import java.util.WeakHashMap; + +/** + * Extract values from an Object instance using simple dotted expressions + * such as project.build.sourceDirectory + * + * The implementation supports indexed, nested and mapped properties similar to the JSP way. + * + * @see http://struts.apache.org/1.x/struts-taglib/indexedprops.html";>http://struts.apache.org/1.x/struts-taglib/indexedprops.html Review Comment: 404 ## maven-model/src/test/java/org/apache/maven/model/v4/Xpp3DomPerfTest.java: ## @@ -18,22 +18,6 @@ */ package org.apache.maven.model.v4; -/* Review Comment: I checked. This is hard violation of Apache policy. From https://www.apache.org/legal/src-headers.html Do not modify or remove any copyright notices or licenses within third-party works. Make sure that every third-party work includes its associated license, even if that requires adding a copy of the license from the third-party download site into the distribution. Do not add the standard Apache License header to the top of third-party source files. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17764414#comment-17764414 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1323636892 ## maven-core/src/main/java/org/apache/maven/utils/introspection/ReflectionValueExtractor.java: ## @@ -0,0 +1,325 @@ +/* + * 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. + */ +package org.apache.maven.utils.introspection; + +import java.lang.ref.WeakReference; +import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; +import java.util.WeakHashMap; + +/** + * + * Using simple dotted expressions to extract the values from an Object instance, For example we might want to extract a + * value like: project.build.sourceDirectory + * + * + * The implementation supports indexed, nested and mapped properties similar to the JSP way. + * + * + * @author mailto:ja...@maven.org";>Jason van Zyl + * @author mailto:vincent.sive...@gmail.com";>Vincent Siveton + * + * @see http://struts.apache.org/1.x/struts-taglib/indexedprops.html";>http://struts.apache.org/1.x/struts-taglib/indexedprops.html + */ +public class ReflectionValueExtractor { +private static final Class[] CLASS_ARGS = new Class[0]; + +private static final Object[] OBJECT_ARGS = new Object[0]; + +/** + * Use a WeakHashMap here, so the keys (Class objects) can be garbage collected. This approach prevents permgen + * space overflows due to retention of discarded classloaders. + */ +private static final Map, WeakReference> CLASS_MAPS = new WeakHashMap<>(); + +static final int EOF = -1; Review Comment: Fixed > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17764415#comment-17764415 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1323637084 ## maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchainFactory.java: ## @@ -86,9 +86,9 @@ public ToolchainPrivate createToolchain(ToolchainModel model) throws Misconfigur throw new MisconfiguredToolchainException( "Java toolchain without the " + JavaToolchainImpl.KEY_JAVAHOME + " configuration element."); } -File normal = new File(FileUtils.normalize(javahome.getValue())); +File normal = Paths.get(javahome.getValue()).normalize().toFile(); Review Comment: Fixed ## maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchainImpl.java: ## @@ -53,7 +53,7 @@ public String toString() { } public String findTool(String toolName) { -File toRet = findTool(toolName, new File(FileUtils.normalize(getJavaHome(; +File toRet = findTool(toolName, Paths.get(getJavaHome()).normalize().toFile()); Review Comment: Fixed > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17764413#comment-17764413 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1323636571 ## maven-core/src/main/java/org/apache/maven/utils/introspection/ReflectionValueExtractor.java: ## @@ -0,0 +1,325 @@ +/* + * 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. + */ +package org.apache.maven.utils.introspection; + +import java.lang.ref.WeakReference; +import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; +import java.util.WeakHashMap; + +/** + * + * Using simple dotted expressions to extract the values from an Object instance, For example we might want to extract a + * value like: project.build.sourceDirectory + * + * + * The implementation supports indexed, nested and mapped properties similar to the JSP way. + * + * + * @author mailto:ja...@maven.org";>Jason van Zyl + * @author mailto:vincent.sive...@gmail.com";>Vincent Siveton + * + * @see http://struts.apache.org/1.x/struts-taglib/indexedprops.html";>http://struts.apache.org/1.x/struts-taglib/indexedprops.html + */ +public class ReflectionValueExtractor { +private static final Class[] CLASS_ARGS = new Class[0]; + +private static final Object[] OBJECT_ARGS = new Object[0]; + +/** + * Use a WeakHashMap here, so the keys (Class objects) can be garbage collected. This approach prevents permgen + * space overflows due to retention of discarded classloaders. + */ +private static final Map, WeakReference> CLASS_MAPS = new WeakHashMap<>(); + +static final int EOF = -1; + +static final char PROPERTY_START = '.'; + +static final char INDEXED_START = '['; + +static final char INDEXED_END = ']'; + +static final char MAPPED_START = '('; + +static final char MAPPED_END = ')'; + +static class Tokenizer { +final String expression; + +int idx; + +Tokenizer(String expression) { +this.expression = expression; +} + +public int peekChar() { +return idx < expression.length() ? expression.charAt(idx) : EOF; +} + +public int skipChar() { +return idx < expression.length() ? expression.charAt(idx++) : EOF; +} + +public String nextToken(char delimiter) { +int start = idx; + +while (idx < expression.length() && delimiter != expression.charAt(idx)) { +idx++; +} + +// delimiter MUST be present +if (idx <= start || idx >= expression.length()) { +return null; +} + +return expression.substring(start, idx++); +} + +public String nextPropertyName() { +final int start = idx; + +while (idx < expression.length() && Character.isJavaIdentifierPart(expression.charAt(idx))) { +idx++; +} + +// property name does not require delimiter +if (idx <= start || idx > expression.length()) { +return null; +} + +return expression.substring(start, idx); +} + +public int getPosition() { +return idx < expression.length() ? idx : EOF; +} + +// to make tokenizer look pretty in debugger +@Override +public String toString() { +return idx < expression.length() ? expression.substring(idx) : ""; +} +} + +private ReflectionValueExtractor() {} + +/** + * The implementation supports indexed, nested and mapped properties. + * + * + * nested properties should be defined by a dot, i.e. "user.address.street" + * indexed properties (java.util.List or array instance) should be contains (\\w+)\\[(\\d+)\\] + * pattern, i.e. "user.addresses[1].street" + * mapped properties should be contains (\\w+)\\((.+)\\) pattern, i.e. + * "user.addresses
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17764411#comment-17764411 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1323636017 ## maven-core/src/main/java/org/apache/maven/utils/introspection/ReflectionValueExtractor.java: ## @@ -0,0 +1,325 @@ +/* + * 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. + */ +package org.apache.maven.utils.introspection; + +import java.lang.ref.WeakReference; +import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; +import java.util.WeakHashMap; + +/** + * + * Using simple dotted expressions to extract the values from an Object instance, For example we might want to extract a + * value like: project.build.sourceDirectory + * + * + * The implementation supports indexed, nested and mapped properties similar to the JSP way. + * + * + * @author mailto:ja...@maven.org";>Jason van Zyl + * @author mailto:vincent.sive...@gmail.com";>Vincent Siveton + * + * @see http://struts.apache.org/1.x/struts-taglib/indexedprops.html";>http://struts.apache.org/1.x/struts-taglib/indexedprops.html + */ +public class ReflectionValueExtractor { +private static final Class[] CLASS_ARGS = new Class[0]; + +private static final Object[] OBJECT_ARGS = new Object[0]; + +/** + * Use a WeakHashMap here, so the keys (Class objects) can be garbage collected. This approach prevents permgen + * space overflows due to retention of discarded classloaders. + */ +private static final Map, WeakReference> CLASS_MAPS = new WeakHashMap<>(); + +static final int EOF = -1; + +static final char PROPERTY_START = '.'; + +static final char INDEXED_START = '['; + +static final char INDEXED_END = ']'; + +static final char MAPPED_START = '('; + +static final char MAPPED_END = ')'; + +static class Tokenizer { +final String expression; + +int idx; + +Tokenizer(String expression) { +this.expression = expression; +} + +public int peekChar() { +return idx < expression.length() ? expression.charAt(idx) : EOF; +} + +public int skipChar() { +return idx < expression.length() ? expression.charAt(idx++) : EOF; +} + +public String nextToken(char delimiter) { +int start = idx; + +while (idx < expression.length() && delimiter != expression.charAt(idx)) { +idx++; +} + +// delimiter MUST be present +if (idx <= start || idx >= expression.length()) { +return null; +} + +return expression.substring(start, idx++); +} + +public String nextPropertyName() { +final int start = idx; + +while (idx < expression.length() && Character.isJavaIdentifierPart(expression.charAt(idx))) { +idx++; +} + +// property name does not require delimiter +if (idx <= start || idx > expression.length()) { +return null; +} + +return expression.substring(start, idx); +} + +public int getPosition() { +return idx < expression.length() ? idx : EOF; +} + +// to make tokenizer look pretty in debugger +@Override +public String toString() { +return idx < expression.length() ? expression.substring(idx) : ""; +} +} + +private ReflectionValueExtractor() {} + +/** + * The implementation supports indexed, nested and mapped properties. + * + * + * nested properties should be defined by a dot, i.e. "user.address.street" + * indexed properties (java.util.List or array instance) should be contains (\\w+)\\[(\\d+)\\] + * pattern, i.e. "user.addresses[1].street" + * mapped properties should be contains (\\w+)\\((.+)\\) pattern, i.e. + * "user.addresses
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17764342#comment-17764342 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1323448246 ## maven-core/src/main/java/org/apache/maven/utils/introspection/ReflectionValueExtractor.java: ## @@ -0,0 +1,325 @@ +/* Review Comment: I've explained those earlier. They come from Apache, so I think it's safe to remove the headers on the 3 files from this package. That's what I did in a more recent commit. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17764167#comment-17764167 ] ASF GitHub Bot commented on MNG-7820: - elharo commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1322972137 ## maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchainFactory.java: ## @@ -86,9 +86,9 @@ public ToolchainPrivate createToolchain(ToolchainModel model) throws Misconfigur throw new MisconfiguredToolchainException( "Java toolchain without the " + JavaToolchainImpl.KEY_JAVAHOME + " configuration element."); } -File normal = new File(FileUtils.normalize(javahome.getValue())); +File normal = Paths.get(javahome.getValue()).normalize().toFile(); Review Comment: No need to convert to a File; just use Files.exists(path) below ## maven-core/src/main/java/org/apache/maven/utils/introspection/ReflectionValueExtractor.java: ## @@ -0,0 +1,325 @@ +/* + * 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. + */ +package org.apache.maven.utils.introspection; + +import java.lang.ref.WeakReference; +import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; +import java.util.WeakHashMap; + +/** + * + * Using simple dotted expressions to extract the values from an Object instance, For example we might want to extract a Review Comment: run on sentence ## maven-core/src/main/java/org/apache/maven/utils/introspection/ReflectionValueExtractor.java: ## @@ -0,0 +1,325 @@ +/* + * 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. + */ +package org.apache.maven.utils.introspection; + +import java.lang.ref.WeakReference; +import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; +import java.util.WeakHashMap; + +/** + * + * Using simple dotted expressions to extract the values from an Object instance, For example we might want to extract a + * value like: project.build.sourceDirectory + * + * + * The implementation supports indexed, nested and mapped properties similar to the JSP way. + * + * + * @author mailto:ja...@maven.org";>Jason van Zyl + * @author mailto:vincent.sive...@gmail.com";>Vincent Siveton + * + * @see http://struts.apache.org/1.x/struts-taglib/indexedprops.html";>http://struts.apache.org/1.x/struts-taglib/indexedprops.html + */ +public class ReflectionValueExtractor { +private static final Class[] CLASS_ARGS = new Class[0]; + +private static final Object[] OBJECT_ARGS = new Object[0]; + +/** + * Use a WeakHashMap here, so the keys (Class objects) can be garbage collected. This approach prevents permgen + * space overflows due to retention of discarded classloaders. + */ +private static final Map, WeakReference> CLASS_MAPS = new WeakHashMap<>(); + +static final int EOF = -1; + +static final char PROPERTY_START = '.'; + +static final char INDEXED_START = '['; + +static final char INDEXED_END = ']'; + +static final char MAPPED_START = '('; + +static final char MAPPED_END = ')'; + +static class Tokenizer { +final String expression; + +int idx;
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17763875#comment-17763875 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on PR #1208: URL: https://github.com/apache/maven/pull/1208#issuecomment-1714387479 @elharo I've rewritten the `dag` related classes with non public classes. The other copyrighted class originate from within the ASF and the last one was written by me. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17763716#comment-17763716 ] ASF GitHub Bot commented on MNG-7820: - slawekjaranowski commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1321550991 ## maven-model-builder/src/main/java/org/apache/maven/utils/Os.java: ## @@ -0,0 +1,213 @@ +/* + * 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. + */ +package org.apache.maven.utils; + +import java.util.Locale; +import java.util.stream.Stream; + +/** + * OS support + */ +public class Os { + +/** + * The OS Name. + */ +public static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.ENGLISH); + +/** + * The OA architecture. + */ +public static final String OS_ARCH = System.getProperty("os.arch").toLowerCase(Locale.ENGLISH); + +/** + * The OS version. + */ +public static final String OS_VERSION = System.getProperty("os.version").toLowerCase(Locale.ENGLISH); + +/** + * OS Family + */ +public static final String OS_FAMILY; + +public static final boolean IS_WINDOWS; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_WINDOWS = "windows"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_WIN9X = "win9x"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_NT = "winnt"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_OS2 = "os/2"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_NETWARE = "netware"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_DOS = "dos"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_MAC = "mac"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_TANDEM = "tandem"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_UNIX = "unix"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_OPENVMS = "openvms"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_ZOS = "z/os"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_OS400 = "os/400"; + +/** + * OpenJDK is reported to call MacOS X "Darwin" + * + * @see https://issues.apache.org/bugzilla/show_bug.cgi?id=44889";>bugzilla issue + * @see https://issues.apache.org/jira/browse/HADOOP-3318";>HADOOP-3318 + */ +private static final String DARWIN = "darwin"; + +/** + * The path separator. + */ +private static final String PATH_SEP = System.getProperty("path.separator"); + +static { +OS_FAMILY = getOsFamily(); +IS_WINDOWS = isWindowsFamily(); +} + +private Os() {} + +/** + * Determines if the OS on which Maven is executing matches the + * given OS family. + * + * @param family the family to check for + * @return true if the OS matches + * + */ +public static boolean isFamily(String family) { Review Comment: Enforcer rule `requireOS` use `plexus.Os` ... so we need check or improve also enfrcer rule in such cases > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17763680#comment-17763680 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1321446764 ## maven-model-builder/src/main/java/org/apache/maven/utils/Os.java: ## @@ -0,0 +1,213 @@ +/* + * 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. + */ +package org.apache.maven.utils; + +import java.util.Locale; +import java.util.stream.Stream; + +/** + * OS support + */ +public class Os { + +/** + * The OS Name. + */ +public static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.ENGLISH); + +/** + * The OA architecture. + */ +public static final String OS_ARCH = System.getProperty("os.arch").toLowerCase(Locale.ENGLISH); + +/** + * The OS version. + */ +public static final String OS_VERSION = System.getProperty("os.version").toLowerCase(Locale.ENGLISH); + +/** + * OS Family + */ +public static final String OS_FAMILY; + +public static final boolean IS_WINDOWS; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_WINDOWS = "windows"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_WIN9X = "win9x"; Review Comment: same ## maven-model-builder/src/main/java/org/apache/maven/utils/Os.java: ## @@ -0,0 +1,213 @@ +/* + * 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. + */ +package org.apache.maven.utils; + +import java.util.Locale; +import java.util.stream.Stream; + +/** + * OS support + */ +public class Os { + +/** + * The OS Name. + */ +public static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.ENGLISH); + +/** + * The OA architecture. + */ +public static final String OS_ARCH = System.getProperty("os.arch").toLowerCase(Locale.ENGLISH); + +/** + * The OS version. + */ +public static final String OS_VERSION = System.getProperty("os.version").toLowerCase(Locale.ENGLISH); + +/** + * OS Family + */ +public static final String OS_FAMILY; + +public static final boolean IS_WINDOWS; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_WINDOWS = "windows"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_WIN9X = "win9x"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_NT = "winnt"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_OS2 = "os/2"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_NETWARE = "netware"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_DOS = "dos"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_MAC = "mac"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_TANDEM = "tandem"; + +/** + * OS family that can be tested
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17763679#comment-17763679 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1321446465 ## maven-model-builder/src/main/java/org/apache/maven/utils/Os.java: ## @@ -0,0 +1,213 @@ +/* + * 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. + */ +package org.apache.maven.utils; + +import java.util.Locale; +import java.util.stream.Stream; + +/** + * OS support + */ +public class Os { + +/** + * The OS Name. + */ +public static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.ENGLISH); + +/** + * The OA architecture. + */ +public static final String OS_ARCH = System.getProperty("os.arch").toLowerCase(Locale.ENGLISH); + +/** + * The OS version. + */ +public static final String OS_VERSION = System.getProperty("os.version").toLowerCase(Locale.ENGLISH); + +/** + * OS Family + */ +public static final String OS_FAMILY; + +public static final boolean IS_WINDOWS; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_WINDOWS = "windows"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_WIN9X = "win9x"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_NT = "winnt"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_OS2 = "os/2"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_NETWARE = "netware"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_DOS = "dos"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_MAC = "mac"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_TANDEM = "tandem"; Review Comment: I disagree, even if I have no idea what `tandem` is, I don't want this PR to affect the behaviour. ## maven-model-builder/src/main/java/org/apache/maven/utils/Os.java: ## @@ -0,0 +1,213 @@ +/* + * 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. + */ +package org.apache.maven.utils; + +import java.util.Locale; +import java.util.stream.Stream; + +/** + * OS support + */ +public class Os { + +/** + * The OS Name. + */ +public static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.ENGLISH); + +/** + * The OA architecture. + */ +public static final String OS_ARCH = System.getProperty("os.arch").toLowerCase(Locale.ENGLISH); + +/** + * The OS version. + */ +public static final String OS_VERSION = System.getProperty("os.version").toLowerCase(Locale.ENGLISH); + +/** + * OS Family + */ +public static final String OS_FAMILY; + +public static final boolean IS_WINDOWS; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_WINDOWS = "windows"; + +/** + * OS family that can be tested for. {@value} + */ +publ
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17763677#comment-17763677 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1321445365 ## maven-model-builder/src/main/java/org/apache/maven/utils/Os.java: ## @@ -0,0 +1,213 @@ +/* + * 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. + */ +package org.apache.maven.utils; + +import java.util.Locale; +import java.util.stream.Stream; + +/** + * OS support + */ +public class Os { + +/** + * The OS Name. + */ +public static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.ENGLISH); + +/** + * The OA architecture. + */ +public static final String OS_ARCH = System.getProperty("os.arch").toLowerCase(Locale.ENGLISH); + +/** + * The OS version. + */ +public static final String OS_VERSION = System.getProperty("os.version").toLowerCase(Locale.ENGLISH); + +/** + * OS Family + */ +public static final String OS_FAMILY; + +public static final boolean IS_WINDOWS; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_WINDOWS = "windows"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_WIN9X = "win9x"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_NT = "winnt"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_OS2 = "os/2"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_NETWARE = "netware"; Review Comment: They are documented, this PR is not about changing the current behaviour. Trimming down the list of supported OS should be a separate JIRA issue / PR. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17763676#comment-17763676 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1321443872 ## maven-model-builder/src/main/java/org/apache/maven/utils/Os.java: ## @@ -0,0 +1,213 @@ +/* + * 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. + */ +package org.apache.maven.utils; + +import java.util.Locale; +import java.util.stream.Stream; + +/** + * OS support + */ +public class Os { + +/** + * The OS Name. + */ +public static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.ENGLISH); + +/** + * The OA architecture. + */ +public static final String OS_ARCH = System.getProperty("os.arch").toLowerCase(Locale.ENGLISH); + +/** + * The OS version. + */ +public static final String OS_VERSION = System.getProperty("os.version").toLowerCase(Locale.ENGLISH); + +/** + * OS Family + */ +public static final String OS_FAMILY; + +public static final boolean IS_WINDOWS; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_WINDOWS = "windows"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_WIN9X = "win9x"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_NT = "winnt"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_OS2 = "os/2"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_NETWARE = "netware"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_DOS = "dos"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_MAC = "mac"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_TANDEM = "tandem"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_UNIX = "unix"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_OPENVMS = "openvms"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_ZOS = "z/os"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_OS400 = "os/400"; + +/** + * OpenJDK is reported to call MacOS X "Darwin" + * + * @see https://issues.apache.org/bugzilla/show_bug.cgi?id=44889";>bugzilla issue + * @see https://issues.apache.org/jira/browse/HADOOP-3318";>HADOOP-3318 + */ +private static final String DARWIN = "darwin"; + +/** + * The path separator. + */ +private static final String PATH_SEP = System.getProperty("path.separator"); + +static { +OS_FAMILY = getOsFamily(); +IS_WINDOWS = isWindowsFamily(); +} + +private Os() {} + +/** + * Determines if the OS on which Maven is executing matches the + * given OS family. + * + * @param family the family to check for + * @return true if the OS matches + * + */ +public static boolean isFamily(String family) { Review Comment: Yes, I think you missed the fact that it's part of the public Maven 3.x API because it's used by [OS profile activation](https://github.com/apache/maven/blob/3ce0d951c199c9a0e9375f23587dcd7b1b657026/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/OperatingSystemProfileActivator.java#L140) and the families are documented on the [Maven site](https://maven.apache.org/enforcer/enforcer-rules/requireOS.html), so I don't think it makes much sense making those constants private as they are publicly documented, even if technically, they could be made private. > Remove dependency on plexus-utils
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17763656#comment-17763656 ] ASF GitHub Bot commented on MNG-7820: - elharo commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1321373092 ## maven-core/src/main/java/org/apache/maven/utils/dag/Dag.java: ## @@ -0,0 +1,255 @@ +/* + * 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. + */ +package org.apache.maven.utils.dag; + +/* + * Copyright The Codehaus Foundation. Review Comment: ditto. Possibly start here: https://incubator.apache.org/ip-clearance/ip-clearance-template.html ## maven-core/src/main/java/org/apache/maven/utils/dag/CycleDetector.java: ## @@ -0,0 +1,131 @@ +/* + * 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. + */ +package org.apache.maven.utils.dag; + +/* + * Copyright The Codehaus Foundation. Review Comment: as above ## maven-model-builder/src/main/java/org/apache/maven/utils/Os.java: ## @@ -0,0 +1,213 @@ +/* + * 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. + */ +package org.apache.maven.utils; + +import java.util.Locale; +import java.util.stream.Stream; + +/** + * OS support + */ +public class Os { + +/** + * The OS Name. + */ +public static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.ENGLISH); + +/** + * The OA architecture. + */ +public static final String OS_ARCH = System.getProperty("os.arch").toLowerCase(Locale.ENGLISH); + +/** + * The OS version. + */ +public static final String OS_VERSION = System.getProperty("os.version").toLowerCase(Locale.ENGLISH); + +/** + * OS Family + */ +public static final String OS_FAMILY; + +public static final boolean IS_WINDOWS; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_WINDOWS = "windows"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_WIN9X = "win9x"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_NT = "winnt"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_OS2 = "os/2"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_NETWARE = "netware"; + +/** + * OS family that can be tested for. {@value} + */ +public static final String FAMILY_DOS = "dos"; + +/** + * OS family that can be tested f
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17763592#comment-17763592 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on PR #1208: URL: https://github.com/apache/maven/pull/1208#issuecomment-1713389394 @elharo could you take another look ? > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17760984#comment-17760984 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1311737481 ## maven-core/src/main/java/org/apache/maven/utils/dag/Vertex.java: ## @@ -0,0 +1,151 @@ +/* Review Comment: We can keep the codehaus header below the package I think. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17760893#comment-17760893 ] ASF GitHub Bot commented on MNG-7820: - elharo commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1311520008 ## maven-core/src/main/java/org/apache/maven/utils/dag/DAG.java: ## @@ -0,0 +1,240 @@ +/* + * 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. + */ +package org.apache.maven.utils.dag; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * DAG = Directed Acyclic Graph + * + * @author Michal Maczka + * + * TODO this class should be renamed from DAG to Dag Review Comment: Now is the time to do this ## maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java: ## @@ -103,6 +102,10 @@ public class DefaultProjectBuilder implements ProjectBuilder { private final RootLocator rootLocator; +public static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.US); Review Comment: private ## maven-model-builder/src/main/java/org/apache/maven/utils/Os.java: ## @@ -0,0 +1,383 @@ +/* Review Comment: This can't be copied over as is. It needs to be cleaned up and rethought. It's horribly out of date. ## maven-core/src/main/java/org/apache/maven/utils/dag/CycleDetectedException.java: ## @@ -0,0 +1,40 @@ +/* + * 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. + */ +package org.apache.maven.utils.dag; Review Comment: This DAG stuff should probably be a separate PR from random StringUtils and IO fixes. ## maven-model/src/main/java/org/apache/maven/model/io/xpp3/MavenXpp3ReaderEx.java: ## @@ -112,13 +119,13 @@ public Model read(InputStream in, InputSource source) throws IOException, XmlPul * * @param parser a parser object. * @param strict a strict object. - * @throws IOException IOException if any. - * @throws XmlPullParserException XmlPullParserException if - * any. * @return Model + * @throws IOExceptionIOException if any. Review Comment: no period, and in general "if any" is not sufficient description. Something like "if an I/O error occurs while reading from the underlying source" ## maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java: ## @@ -103,6 +102,10 @@ public class DefaultProjectBuilder implements ProjectBuilder { private final RootLocator rootLocator; +public static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.US); + +public static final String FAMILY_WINDOWS = "windows"; Review Comment: private In general, avoid introducing new public API ## maven-core/src/main/java/org/apache/maven/properties/internal/EnvironmentUtils.java: ## @@ -36,6 +34,10 @@ public class EnvironmentUtils { private static Properties envVars; +public static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.US); Review Comment: private ## maven-core/src/main/java/org/apache/maven/utils/introspection/ReflectionValueExtractor.java: ## @@ -0,0 +1,325 @@ +/* + * Licensed to the Apache Softwar
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17760701#comment-17760701 ] ASF GitHub Bot commented on MNG-7820: - CrazyHZM commented on PR #1208: URL: https://github.com/apache/maven/pull/1208#issuecomment-1700313477 @elharo Thanks to this careful review, I went over javadoc again and fixed the problems. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17760490#comment-17760490 ] ASF GitHub Bot commented on MNG-7820: - elharo commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1310423407 ## maven-core/src/main/java/org/apache/maven/utils/dag/DAG.java: ## @@ -0,0 +1,239 @@ +/* + * 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. + */ +package org.apache.maven.utils.dag; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * DAG = Directed Acyclic Graph + * + * @author Michal Maczka + * + * TODO this class should be renamed from DAG to Dag + */ +public class DAG implements Cloneable, Serializable { +// +// Fields +// +/** + * Nodes will be kept in two data structures at the same time for faster processing + */ +/** + * Maps vertex's label to vertex + */ +private Map vertexMap = new HashMap<>(); + +/** + * Conatin list of all vertices + */ +private List vertexList = new ArrayList<>(); + +// +// Constructors +// + +/** + * + */ +public DAG() { +super(); +} + +// +// Accessors +// + +/** + * @return the vertices + */ +public List getVertices() { +return vertexList; +} + +/** + * @deprecated instead use {@link #getVertices()} + * @return the vertices + */ +@Deprecated +public List getVerticies() { +return getVertices(); +} + +public Set getLabels() { +return vertexMap.keySet(); +} + +// +// Implementation +// + +/** + * Adds vertex to DAG. If vertex of given label already exist in DAG no vertex is added + * + * @param label The label of the Vertex + * @return New vertex if vertex of given label was not present in the DAG or existing vertex if vertex of given + * label was already added to DAG + */ +public Vertex addVertex(final String label) { +Vertex retValue = null; + +// check if vertex is already in DAG +if (vertexMap.containsKey(label)) { +retValue = vertexMap.get(label); +} else { +retValue = new Vertex(label); + +vertexMap.put(label, retValue); + +vertexList.add(retValue); +} + +return retValue; +} + +public void addEdge(final String from, final String to) throws CycleDetectedException { +final Vertex v1 = addVertex(from); + +final Vertex v2 = addVertex(to); + +addEdge(v1, v2); +} + +public void addEdge(final Vertex from, final Vertex to) throws CycleDetectedException { + +from.addEdgeTo(to); + +to.addEdgeFrom(from); + +final List cycle = CycleDetector.introducesCycle(to); + +if (cycle != null) { +// remove edge which introduced cycle + +removeEdge(from, to); + +final String msg = "Edge between '" + from + "' and '" + to + "' introduces to cycle in the graph"; + +throw new CycleDetectedException(msg, cycle); +} +} + +public void removeEdge(final String from, final String to) { +final Vertex v1 = addVertex(from); + +final Vertex v2 = addVertex(to); + +removeEdge(v1, v2); +} + +public void removeEdge(final Vertex from, final Vertex to) { +from.removeEdgeTo(to); + +to.removeEdgeFrom(from); +} + +public Vertex getVertex(final String label) { +final Ver
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17760488#comment-17760488 ] ASF GitHub Bot commented on MNG-7820: - elharo commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1310422373 ## maven-core/src/main/java/org/apache/maven/utils/dag/Vertex.java: ## @@ -0,0 +1,151 @@ +/* + * 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. + */ +package org.apache.maven.utils.dag; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @author Michal Maczka + * + */ +public class Vertex implements Cloneable, Serializable { +// +// Fields +// +private String label = null; + +List children = new ArrayList<>(); + +List parents = new ArrayList<>(); + +// +// Constructors +// + +public Vertex(final String label) { +this.label = label; +} + +// +// Accessors +// + +public String getLabel() { +return label; +} + +public void addEdgeTo(final Vertex vertex) { +children.add(vertex); +} + +public void removeEdgeTo(final Vertex vertex) { +children.remove(vertex); +} + +public void addEdgeFrom(final Vertex vertex) { +parents.add(vertex); +} + +public void removeEdgeFrom(final Vertex vertex) { +parents.remove(vertex); +} + +public List getChildren() { +return children; +} + +/** + * Get the labels used by the most direct children. + * + * @return the labels used by the most direct children. Review Comment: no period, per Oracle guidelines > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17760485#comment-17760485 ] ASF GitHub Bot commented on MNG-7820: - CrazyHZM commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1310415013 ## maven-core/src/main/java/org/apache/maven/utils/dag/DAG.java: ## @@ -0,0 +1,239 @@ +/* + * 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. + */ +package org.apache.maven.utils.dag; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * DAG = Directed Acyclic Graph + * + * @author Michal Maczka + * + * TODO this class should be renamed from DAG to Dag + */ +public class DAG implements Cloneable, Serializable { +// +// Fields +// +/** + * Nodes will be kept in two data structures at the same time for faster processing + */ +/** + * Maps vertex's label to vertex + */ +private Map vertexMap = new HashMap<>(); + +/** + * Conatin list of all vertices + */ +private List vertexList = new ArrayList<>(); + +// +// Constructors +// + +/** + * + */ +public DAG() { +super(); +} + +// +// Accessors +// + +/** + * @return the vertices + */ +public List getVertices() { +return vertexList; +} + +/** + * @deprecated instead use {@link #getVertices()} + * @return the vertices + */ +@Deprecated +public List getVerticies() { +return getVertices(); +} + +public Set getLabels() { +return vertexMap.keySet(); +} + +// +// Implementation +// + +/** + * Adds vertex to DAG. If vertex of given label already exist in DAG no vertex is added + * + * @param label The label of the Vertex + * @return New vertex if vertex of given label was not present in the DAG or existing vertex if vertex of given + * label was already added to DAG + */ +public Vertex addVertex(final String label) { +Vertex retValue = null; + +// check if vertex is already in DAG +if (vertexMap.containsKey(label)) { +retValue = vertexMap.get(label); +} else { +retValue = new Vertex(label); + +vertexMap.put(label, retValue); + +vertexList.add(retValue); +} + +return retValue; +} + +public void addEdge(final String from, final String to) throws CycleDetectedException { +final Vertex v1 = addVertex(from); + +final Vertex v2 = addVertex(to); + +addEdge(v1, v2); +} + +public void addEdge(final Vertex from, final Vertex to) throws CycleDetectedException { + +from.addEdgeTo(to); + +to.addEdgeFrom(from); + +final List cycle = CycleDetector.introducesCycle(to); + +if (cycle != null) { +// remove edge which introduced cycle + +removeEdge(from, to); + +final String msg = "Edge between '" + from + "' and '" + to + "' introduces to cycle in the graph"; + +throw new CycleDetectedException(msg, cycle); +} +} + +public void removeEdge(final String from, final String to) { +final Vertex v1 = addVertex(from); + +final Vertex v2 = addVertex(to); + +removeEdge(v1, v2); +} + +public void removeEdge(final Vertex from, final Vertex to) { +from.removeEdgeTo(to); + +to.removeEdgeFrom(from); +} + +public Vertex getVertex(final String label) { +final V
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17760486#comment-17760486 ] ASF GitHub Bot commented on MNG-7820: - CrazyHZM commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1310415877 ## maven-core/src/main/java/org/apache/maven/utils/dag/DAG.java: ## @@ -0,0 +1,239 @@ +/* + * 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. + */ +package org.apache.maven.utils.dag; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * DAG = Directed Acyclic Graph + * + * @author Michal Maczka + * + * TODO this class should be renamed from DAG to Dag + */ +public class DAG implements Cloneable, Serializable { +// +// Fields +// +/** + * Nodes will be kept in two data structures at the same time for faster processing + */ +/** + * Maps vertex's label to vertex + */ +private Map vertexMap = new HashMap<>(); + +/** + * Conatin list of all vertices + */ +private List vertexList = new ArrayList<>(); + +// +// Constructors +// + +/** + * + */ +public DAG() { +super(); +} + +// +// Accessors +// + +/** + * @return the vertices + */ +public List getVertices() { +return vertexList; +} + +/** + * @deprecated instead use {@link #getVertices()} + * @return the vertices + */ +@Deprecated +public List getVerticies() { +return getVertices(); +} + +public Set getLabels() { +return vertexMap.keySet(); +} + +// +// Implementation +// + +/** + * Adds vertex to DAG. If vertex of given label already exist in DAG no vertex is added + * + * @param label The label of the Vertex + * @return New vertex if vertex of given label was not present in the DAG or existing vertex if vertex of given + * label was already added to DAG + */ +public Vertex addVertex(final String label) { +Vertex retValue = null; + +// check if vertex is already in DAG +if (vertexMap.containsKey(label)) { +retValue = vertexMap.get(label); +} else { +retValue = new Vertex(label); + +vertexMap.put(label, retValue); + +vertexList.add(retValue); +} + +return retValue; +} + +public void addEdge(final String from, final String to) throws CycleDetectedException { +final Vertex v1 = addVertex(from); + +final Vertex v2 = addVertex(to); + +addEdge(v1, v2); +} + +public void addEdge(final Vertex from, final Vertex to) throws CycleDetectedException { + +from.addEdgeTo(to); + +to.addEdgeFrom(from); + +final List cycle = CycleDetector.introducesCycle(to); + +if (cycle != null) { +// remove edge which introduced cycle + +removeEdge(from, to); + +final String msg = "Edge between '" + from + "' and '" + to + "' introduces to cycle in the graph"; + +throw new CycleDetectedException(msg, cycle); +} +} + +public void removeEdge(final String from, final String to) { +final Vertex v1 = addVertex(from); + +final Vertex v2 = addVertex(to); + +removeEdge(v1, v2); +} + +public void removeEdge(final Vertex from, final Vertex to) { +from.removeEdgeTo(to); + +to.removeEdgeFrom(from); +} + +public Vertex getVertex(final String label) { +final V
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17760466#comment-17760466 ] ASF GitHub Bot commented on MNG-7820: - elharo commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1310379975 ## maven-core/src/main/java/org/apache/maven/utils/dag/DAG.java: ## @@ -0,0 +1,239 @@ +/* + * 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. + */ +package org.apache.maven.utils.dag; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * DAG = Directed Acyclic Graph + * + * @author Michal Maczka + * + * TODO this class should be renamed from DAG to Dag + */ +public class DAG implements Cloneable, Serializable { +// +// Fields +// +/** + * Nodes will be kept in two data structures at the same time for faster processing + */ +/** + * Maps vertex's label to vertex + */ +private Map vertexMap = new HashMap<>(); + +/** + * Conatin list of all vertices + */ +private List vertexList = new ArrayList<>(); + +// +// Constructors +// + +/** + * + */ +public DAG() { +super(); +} + +// +// Accessors +// + +/** + * @return the vertices + */ +public List getVertices() { +return vertexList; +} + +/** + * @deprecated instead use {@link #getVertices()} + * @return the vertices + */ +@Deprecated +public List getVerticies() { +return getVertices(); +} + +public Set getLabels() { +return vertexMap.keySet(); +} + +// +// Implementation +// + +/** + * Adds vertex to DAG. If vertex of given label already exist in DAG no vertex is added + * + * @param label The label of the Vertex + * @return New vertex if vertex of given label was not present in the DAG or existing vertex if vertex of given + * label was already added to DAG + */ +public Vertex addVertex(final String label) { +Vertex retValue = null; + +// check if vertex is already in DAG +if (vertexMap.containsKey(label)) { +retValue = vertexMap.get(label); +} else { +retValue = new Vertex(label); + +vertexMap.put(label, retValue); + +vertexList.add(retValue); +} + +return retValue; +} + +public void addEdge(final String from, final String to) throws CycleDetectedException { +final Vertex v1 = addVertex(from); + +final Vertex v2 = addVertex(to); + +addEdge(v1, v2); +} + +public void addEdge(final Vertex from, final Vertex to) throws CycleDetectedException { + +from.addEdgeTo(to); + +to.addEdgeFrom(from); + +final List cycle = CycleDetector.introducesCycle(to); + +if (cycle != null) { +// remove edge which introduced cycle + +removeEdge(from, to); + +final String msg = "Edge between '" + from + "' and '" + to + "' introduces to cycle in the graph"; + +throw new CycleDetectedException(msg, cycle); +} +} + +public void removeEdge(final String from, final String to) { +final Vertex v1 = addVertex(from); + +final Vertex v2 = addVertex(to); + +removeEdge(v1, v2); +} + +public void removeEdge(final Vertex from, final Vertex to) { +from.removeEdgeTo(to); + +to.removeEdgeFrom(from); +} + +public Vertex getVertex(final String label) { +final Ver
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17760436#comment-17760436 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1310368704 ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { +String message; +if (!source.exists()) { +message = "File " + source + " does not exist"; +throw new IOException(message); +} else if (!source.getCanonicalPath().equals(destination.getCanonicalPath())) { +File parentFile = destination.getParentFile(); +if (parentFile != null && !parentFile.exists()) { +parentFile.mkdirs(); Review Comment: The method has been removed. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17760434#comment-17760434 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1310366044 ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { Review Comment: Method removed > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759577#comment-17759577 ] ASF GitHub Bot commented on MNG-7820: - elharo commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1307372298 ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { +String message; +if (!source.exists()) { +message = "File " + source + " does not exist"; +throw new IOException(message); +} else if (!source.getCanonicalPath().equals(destination.getCanonicalPath())) { +File parentFile = destination.getParentFile(); +if (parentFile != null && !parentFile.exists()) { +parentFile.mkdirs(); Review Comment: The existing code is buggy and can fail. There is no guarantee mkdirs succeeds here. ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { +String message; +if (!source.exists()) { +message = "File " + source + " does not exist"; +throw new IOException(message); +} else if (!source.getCanonicalPath().equals(destination.getCanonicalPath())) { +File parentFile = destination.getParentFile(); +if (parentFile != null && !parentFile.exists()) { +parentFile.mkdirs(); +} +Files.copy( +source.toPath(), +destination.toPath(), +StandardCopyOption.REPLACE_EXISTING, +StandardCopyOption.COPY_ATTRIBUTES); +if (source.length() != destination.length()) { Review Comment: There's some shared history between all of these, and they have the same failure modes and issues. That's why we need to move away from all of them and use the JDK methods that are available in Java 7+ that did not exist 20 years ago when this buggy code was first written. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759375#comment-17759375 ] ASF GitHub Bot commented on MNG-7820: - CrazyHZM commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1306681408 ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { +String message; +if (!source.exists()) { +message = "File " + source + " does not exist"; +throw new IOException(message); +} else if (!source.getCanonicalPath().equals(destination.getCanonicalPath())) { +File parentFile = destination.getParentFile(); +if (parentFile != null && !parentFile.exists()) { +parentFile.mkdirs(); +} +Files.copy( +source.toPath(), +destination.toPath(), +StandardCopyOption.REPLACE_EXISTING, +StandardCopyOption.COPY_ATTRIBUTES); +if (source.length() != destination.length()) { Review Comment: @gnodet I find the copyFile method of maven-shared-utils deprecated, I think we don't need to use it anymore. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759334#comment-17759334 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1306630132 ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { +String message; +if (!source.exists()) { +message = "File " + source + " does not exist"; +throw new IOException(message); +} else if (!source.getCanonicalPath().equals(destination.getCanonicalPath())) { +File parentFile = destination.getParentFile(); +if (parentFile != null && !parentFile.exists()) { +parentFile.mkdirs(); +} +Files.copy( +source.toPath(), +destination.toPath(), +StandardCopyOption.REPLACE_EXISTING, +StandardCopyOption.COPY_ATTRIBUTES); +if (source.length() != destination.length()) { Review Comment: Fwiw, maven-shared-utils' version of it also has the same check: https://github.com/apache/maven-shared-utils/blob/master/src/main/java/org/apache/maven/shared/utils/io/FileUtils.java#L760 > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759329#comment-17759329 ] ASF GitHub Bot commented on MNG-7820: - CrazyHZM commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1306615720 ## maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java: ## @@ -122,12 +153,54 @@ private boolean determineFamilyMatch(String family) { test = test.substring(1); } -boolean result = Os.isFamily(test); +boolean result = isFamily(test); if (reverse) { return !result; } else { return result; } } + +private boolean isFamily(String family) { Review Comment: > > Just moving code from plexus is not kosher, either technically or legally. plexus-utils has iffy ownership and license status due to the Codehaus mess. Nor has it had good maintenance or updates over the years. It should be replaced de novo. Copy paste of the existing code into this project is not OK. > > @CrazyHZM for `Os`, we need to use [the one from maven-shared-utils instead](https://github.com/apache/maven-shared-utils/blob/master/src/main/java/org/apache/maven/shared/utils/Os.java) @gnodet Done. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759321#comment-17759321 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1306609506 ## maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java: ## @@ -122,12 +153,54 @@ private boolean determineFamilyMatch(String family) { test = test.substring(1); } -boolean result = Os.isFamily(test); +boolean result = isFamily(test); if (reverse) { return !result; } else { return result; } } + +private boolean isFamily(String family) { Review Comment: > Just moving code from plexus is not kosher, either technically or legally. plexus-utils has iffy ownership and license status due to the Codehaus mess. Nor has it had good maintenance or updates over the years. It should be replaced de novo. Copy paste of the existing code into this project is not OK. @CrazyHZM for `Os`, we need to use [the one from maven-shared-utils instead](https://github.com/apache/maven-shared-utils/blob/master/src/main/java/org/apache/maven/shared/utils/Os.java) > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759304#comment-17759304 ] ASF GitHub Bot commented on MNG-7820: - CrazyHZM commented on PR #1208: URL: https://github.com/apache/maven/pull/1208#issuecomment-1694547753 > @gnodet I remigrated the Os classes. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759045#comment-17759045 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on PR #1208: URL: https://github.com/apache/maven/pull/1208#issuecomment-1693347546 @CrazyHZM I've seen the `Os` stuff copied multiple times. Could the class be copied into maven-core and reused instead of duplicating this bits 3/4 times ? > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759043#comment-17759043 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1305645835 ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { +String message; +if (!source.exists()) { +message = "File " + source + " does not exist"; +throw new IOException(message); +} else if (!source.getCanonicalPath().equals(destination.getCanonicalPath())) { +File parentFile = destination.getParentFile(); +if (parentFile != null && !parentFile.exists()) { +parentFile.mkdirs(); Review Comment: Changing the behaviour of legacy / untested code is not a good idea. AND maven-compat is bound to be deleted in 4.1 > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759042#comment-17759042 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1305645105 ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { +String message; +if (!source.exists()) { +message = "File " + source + " does not exist"; +throw new IOException(message); +} else if (!source.getCanonicalPath().equals(destination.getCanonicalPath())) { +File parentFile = destination.getParentFile(); +if (parentFile != null && !parentFile.exists()) { +parentFile.mkdirs(); +} +Files.copy( +source.toPath(), +destination.toPath(), +StandardCopyOption.REPLACE_EXISTING, +StandardCopyOption.COPY_ATTRIBUTES); +if (source.length() != destination.length()) { Review Comment: maven-compat is deprecated and should be gone in Maven 4.1, there's no point in enhancing the code there. Quite the opposite, any change may introduce regressions in legacy / untested code. Untested, because all the ITs have now been updated and that code path isn't used anymore, but in very plugins. If you want to modify a code that has been proven to work, please provide a unit test for that then. Also, the following test simply exhibits that the check has an effect and is not a no-op. The documentation does in no way guarantee that the copy is atomic, it's actually specifically written that it's not. I agree there's no way simple way to ensure that in this code, and I certainly would not want to go in that direction for the reason that code is bound to be removed soon. ``` public static void main(String[] args) throws Exception { Path dir = Files.createTempDirectory("test-"); Path source = dir.resolve("source.txt"); try (Writer w = Files.newBufferedWriter(source, StandardCharsets.UTF_8)) { for (int i = 0; i < 1024 * 1024; i++) { w.append("01234567890\n"); } } Path dest = dir.resolve("dest.txt"); for (int t = 0; t < 4; t++) { new Thread(() -> { try { Files.copy(source, dest, StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES); if (Files.size(source) != Files.size(dest)) { throw new IOException("Failed to copy full contents from " + source + " to " + dest); } } catch (IOException e) { throw new IOError(e); } }).start(); } } ``` > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759037#comment-17759037 ] ASF GitHub Bot commented on MNG-7820: - elharo commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1305624838 ## maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java: ## @@ -122,12 +153,54 @@ private boolean determineFamilyMatch(String family) { test = test.substring(1); } -boolean result = Os.isFamily(test); +boolean result = isFamily(test); if (reverse) { return !result; } else { return result; } } + +private boolean isFamily(String family) { Review Comment: Just moving code from plexus is not kosher, either technically or legally. plexus-utils has iffy ownership and license status due to the Codehaus mess. Nor has it had good maintenance or updates over the years. It should be replaced de novo. Copy paste of the existing code into this project is not OK. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759036#comment-17759036 ] ASF GitHub Bot commented on MNG-7820: - elharo commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1305624838 ## maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java: ## @@ -122,12 +153,54 @@ private boolean determineFamilyMatch(String family) { test = test.substring(1); } -boolean result = Os.isFamily(test); +boolean result = isFamily(test); if (reverse) { return !result; } else { return result; } } + +private boolean isFamily(String family) { Review Comment: Just moving code from plexus is not kosher, either technically or legally. plexus-utils has iffy ownership and license status due to the Codehaus mess. Nor has it had good maintenance or updates over the years. It should be replaced de novo. Copy paste of the existing code is not OK. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759032#comment-17759032 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1305616342 ## maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java: ## @@ -122,12 +153,54 @@ private boolean determineFamilyMatch(String family) { test = test.substring(1); } -boolean result = Os.isFamily(test); +boolean result = isFamily(test); if (reverse) { return !result; } else { return result; } } + +private boolean isFamily(String family) { Review Comment: Mmh, could the reason be that you're considering this code as new code, whereas I consider it as a code move from plexus-utils ? If it was good to be used there, I assume it's good to be used in maven too as-is... So which ones do you want to remove support for exactly ? > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759028#comment-17759028 ] ASF GitHub Bot commented on MNG-7820: - elharo commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1305598002 ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { +String message; +if (!source.exists()) { +message = "File " + source + " does not exist"; +throw new IOException(message); +} else if (!source.getCanonicalPath().equals(destination.getCanonicalPath())) { +File parentFile = destination.getParentFile(); +if (parentFile != null && !parentFile.exists()) { +parentFile.mkdirs(); +} +Files.copy( +source.toPath(), +destination.toPath(), +StandardCopyOption.REPLACE_EXISTING, +StandardCopyOption.COPY_ATTRIBUTES); +if (source.length() != destination.length()) { Review Comment: Even with this check it's not safe against concurrent modifications outside this thread or process. I'm willing to assume the JDK method behaves as documented until proven otherwise. And inlining questionable code is no better than writing it from scratch. This block should go. ## maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java: ## @@ -122,12 +153,54 @@ private boolean determineFamilyMatch(String family) { test = test.substring(1); } -boolean result = Os.isFamily(test); +boolean result = isFamily(test); if (reverse) { return !result; } else { return result; } } + +private boolean isFamily(String family) { Review Comment: This can likely be made static, though I wonder if there's more work to be done here. Netware? Windows 98? It amazes me that in one thread I'm trying to convince folks not to drop support for the widely used Java 8 while over here in this PR I'm seeing support for OSs that were defunct circa Java 1.4. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17758853#comment-17758853 ] ASF GitHub Bot commented on MNG-7820: - CrazyHZM commented on PR #1208: URL: https://github.com/apache/maven/pull/1208#issuecomment-1692879432 > Nice, thx ! I think we can also revert the dependency on `commons-io` which was moved from `test` scope to `runtime`. Afaik, it's not used at runtime anymore with the recent changes. @gnodet Done. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17758839#comment-17758839 ] ASF GitHub Bot commented on MNG-7820: - CrazyHZM commented on PR #1208: URL: https://github.com/apache/maven/pull/1208#issuecomment-1692812315 @gnodet All issues should have been resolved except for the `DefaultWagonManager` issue dispute, which was controversial. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17758837#comment-17758837 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on PR #1208: URL: https://github.com/apache/maven/pull/1208#issuecomment-1692789865 > > @elharo I don't really see the need to spend much time on rewriting code copied from a utility class. The DefaultWagonManager is part of maven-compat, so deprecated and not really maintained. Any possible cleanup could introduce problems, so I'm more in favour of a blunt copy/paste, even if the code is not the cleanest, to avoid any possible behaviour difference with this legacy code. > > For information, I've successfully run the whole IT test suite after changing the DefaultWagonManager to throw exceptions instead of actually downloading/uploading anything using a Wagon (and disabling the DefaultWagonManagerTest UT). However, it might still be in use by old plugins, so I would not delete it at this point (we do have warnings when using maven-compat since a few months afaik). But I would not spend too much time on this code either... > > This is different for the DAG stuff which is used by maven-core... > > @gnodet So we should still do some optimization on the copied DAG, right? Yes > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17758819#comment-17758819 ] ASF GitHub Bot commented on MNG-7820: - CrazyHZM commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1305099465 ## maven-core/src/main/java/org/apache/maven/utils/dag/CycleDetector.java: ## @@ -0,0 +1,136 @@ +/* + * 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. + */ +package org.apache.maven.utils.dag; + +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +/** + * @author Michal Maczka + * + */ +public class CycleDetector { + +private static final Integer NOT_VISITED = 0; + +private static final Integer VISITING = 1; + +private static final Integer VISITED = 2; + +public static List hasCycle(final DAG graph) { +final List vertices = graph.getVertices(); + +final Map vertexStateMap = new HashMap<>(); + +List retValue = null; + +for (Vertex vertex : vertices) { +if (isNotVisited(vertex, vertexStateMap)) { +retValue = introducesCycle(vertex, vertexStateMap); + +if (retValue != null) { +break; +} +} +} + +return retValue; +} + +/** + * This method will be called when an edge leading to given vertex was added and we want to check if introduction of Review Comment: Done. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17758818#comment-17758818 ] ASF GitHub Bot commented on MNG-7820: - CrazyHZM commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1305099150 ## maven-core/src/main/java/org/apache/maven/utils/dag/CycleDetector.java: ## @@ -0,0 +1,136 @@ +/* + * 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. + */ +package org.apache.maven.utils.dag; + +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +/** + * @author Michal Maczka + * + */ +public class CycleDetector { + +private static final Integer NOT_VISITED = 0; + +private static final Integer VISITING = 1; + +private static final Integer VISITED = 2; + +public static List hasCycle(final DAG graph) { +final List vertices = graph.getVertices(); + +final Map vertexStateMap = new HashMap<>(); + +List retValue = null; + +for (Vertex vertex : vertices) { +if (isNotVisited(vertex, vertexStateMap)) { +retValue = introducesCycle(vertex, vertexStateMap); + +if (retValue != null) { +break; +} +} +} + +return retValue; +} + +/** + * This method will be called when an edge leading to given vertex was added and we want to check if introduction of + * this edge has not resulted in apparition of cycle in the graph + * + * @param vertex the vertex + * @param vertexStateMap the vertex Map + * @return the found cycle + */ +public static List introducesCycle(final Vertex vertex, final Map vertexStateMap) { Review Comment: change to `private`. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17758817#comment-17758817 ] ASF GitHub Bot commented on MNG-7820: - CrazyHZM commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1305096986 ## maven-core/src/main/java/org/apache/maven/utils/introspection/ReflectionValueExtractor.java: ## @@ -0,0 +1,325 @@ +/* + * 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. + */ +package org.apache.maven.utils.introspection; + +import java.lang.ref.WeakReference; +import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; +import java.util.WeakHashMap; + +/** + * + * Using simple dotted expressions to extract the values from an Object instance, For example we might want to extract a + * value like: project.build.sourceDirectory + * + * + * The implementation supports indexed, nested and mapped properties similar to the JSP way. + * + * + * @author mailto:ja...@maven.org";>Jason van Zyl + * @author mailto:vincent.sive...@gmail.com";>Vincent Siveton + * + * @see http://struts.apache.org/1.x/struts-taglib/indexedprops.html";>http://struts.apache.org/1.x/struts-taglib/indexedprops.html + */ +public class ReflectionValueExtractor { Review Comment: It is used by `org.apache.maven.plugin.PluginParameterExpressionEvaluatorV4` and cannot be made public. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17758794#comment-17758794 ] ASF GitHub Bot commented on MNG-7820: - CrazyHZM commented on PR #1208: URL: https://github.com/apache/maven/pull/1208#issuecomment-1692669455 > @elharo I don't really see the need to spend much time on rewriting code copied from a utility class. The DefaultWagonManager is part of maven-compat, so deprecated and not really maintained. Any possible cleanup could introduce problems, so I'm more in favour of a blunt copy/paste, even if the code is not the cleanest, to avoid any possible behaviour difference with this legacy code. > > For information, I've successfully run the whole IT test suite after changing the DefaultWagonManager to throw exceptions instead of actually downloading/uploading anything using a Wagon (and disabling the DefaultWagonManagerTest UT). However, it might still be in use by old plugins, so I would not delete it at this point (we do have warnings when using maven-compat since a few months afaik). But I would not spend too much time on this code either... > > This is different for the DAG stuff which is used by maven-core... @gnodet So we should still do some optimization on the copied DAG, right? > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17758635#comment-17758635 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1304514826 ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { Review Comment: > I wouldn't assume the existing method is correct. Please use the JDK Files.copy method instead It already uses Files.copy, so I think that's fine. If needed, it can be inlined, but I don't see the benefit. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17758633#comment-17758633 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1304513934 ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { +String message; +if (!source.exists()) { +message = "File " + source + " does not exist"; +throw new IOException(message); +} else if (!source.getCanonicalPath().equals(destination.getCanonicalPath())) { +File parentFile = destination.getParentFile(); +if (parentFile != null && !parentFile.exists()) { +parentFile.mkdirs(); +} +Files.copy( +source.toPath(), +destination.toPath(), +StandardCopyOption.REPLACE_EXISTING, +StandardCopyOption.COPY_ATTRIBUTES); +if (source.length() != destination.length()) { Review Comment: I have no idea what could happen in case of concurrent access to the repository... Copy is not necessarily atomic, so I'm not sure that an exception will always be thrown before this check. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17758632#comment-17758632 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on PR #1208: URL: https://github.com/apache/maven/pull/1208#issuecomment-1691906581 @elharo I don't really see the need to spend much time on rewriting code copied from a utility class. The DefaultWagonManager is part of maven-compat, so deprecated and not really maintained. Any possible cleanup could introduce problems, so I'm more in favour of a blunt copy/paste, even if the code is not the cleanest, to avoid any possible behaviour difference with this legacy code. For information, I've successfully run the whole IT test suite after changing the DefaultWagonManager to throw exceptions instead of actually downloading/uploading anything using a Wagon (and disabling the DefaultWagonManagerTest UT). However, it might still be in use by old plugins, so I would not delete it at this point (we do have warnings when using maven-compat since a few months afaik). But I would not spend too much time on this code either... > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17758553#comment-17758553 ] ASF GitHub Bot commented on MNG-7820: - elharo commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1304233854 ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { +String message; +if (!source.exists()) { +message = "File " + source + " does not exist"; +throw new IOException(message); +} else if (!source.getCanonicalPath().equals(destination.getCanonicalPath())) { +File parentFile = destination.getParentFile(); +if (parentFile != null && !parentFile.exists()) { +parentFile.mkdirs(); +} +Files.copy( +source.toPath(), +destination.toPath(), +StandardCopyOption.REPLACE_EXISTING, +StandardCopyOption.COPY_ATTRIBUTES); +if (source.length() != destination.length()) { Review Comment: This if block isn't needed. If Files.copy doesn't copy everything, an IOException will be thrown above. ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { +String message; +if (!source.exists()) { +message = "File " + source + " does not exist"; +throw new IOException(message); +} else if (!source.getCanonicalPath().equals(destination.getCanonicalPath())) { +File parentFile = destination.getParentFile(); +if (parentFile != null && !parentFile.exists()) { +parentFile.mkdirs(); Review Comment: The return value isn't checked here. Use Files.createDirectories instead and drop the exists check. ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { Review Comment: I think this can be static > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17758550#comment-17758550 ] ASF GitHub Bot commented on MNG-7820: - elharo commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1274774380 ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { +String message; Review Comment: declare where used, and don't reuse for two different messages, or just inline the two uses of this variable > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17758526#comment-17758526 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1304179696 ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { Review Comment: It already uses `Files.copy`, so I think that's fine. If needed, it can be inlined, but I don't see the benefit. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17758515#comment-17758515 ] ASF GitHub Bot commented on MNG-7820: - elharo commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1304137698 ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { Review Comment: I wouldn't assume the existing method is correct. Please use the JDK Files.copy method instead > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17750967#comment-17750967 ] ASF GitHub Bot commented on MNG-7820: - CrazyHZM commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1284026832 ## maven-core/src/main/java/org/apache/maven/utils/dag/CycleDetectedException.java: ## @@ -0,0 +1,54 @@ +/* + * 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. + */ +package org.apache.maven.utils.dag; + +import java.util.Iterator; +import java.util.List; + +public class CycleDetectedException extends Exception { +private List cycle; + +public CycleDetectedException(final String message, final List cycle) { +super(message); + +this.cycle = cycle; +} + +public List getCycle() { +return cycle; +} + +public String cycleToString() { +final StringBuilder buffer = new StringBuilder(); + +for (Iterator iterator = cycle.iterator(); iterator.hasNext(); ) { Review Comment: Done. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17750843#comment-17750843 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1283531940 ## maven-core/src/main/java/org/apache/maven/utils/dag/DAG.java: ## @@ -0,0 +1,239 @@ +/* + * 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. + */ +package org.apache.maven.utils.dag; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * DAG = Directed Acyclic Graph + * + * @author Michal Maczka + * + * TODO this class should be renamed from DAG to Dag + */ +public class DAG implements Cloneable, Serializable { Review Comment: Yes, it's used in `org.apache.maven.project.ProjectSorter` > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17750842#comment-17750842 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1283530419 ## maven-core/src/main/java/org/apache/maven/utils/dag/CycleDetectedException.java: ## @@ -0,0 +1,54 @@ +/* + * 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. + */ +package org.apache.maven.utils.dag; + +import java.util.Iterator; +import java.util.List; + +public class CycleDetectedException extends Exception { +private List cycle; + +public CycleDetectedException(final String message, final List cycle) { +super(message); + +this.cycle = cycle; +} + +public List getCycle() { +return cycle; +} + +public String cycleToString() { +final StringBuilder buffer = new StringBuilder(); + +for (Iterator iterator = cycle.iterator(); iterator.hasNext(); ) { Review Comment: [`String.join(CharSequence, CharSequence...)`](https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#join-java.lang.CharSequence-java.lang.CharSequence...-) has been introduced in JDK 8, so we should rather use that one. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17750819#comment-17750819 ] ASF GitHub Bot commented on MNG-7820: - CrazyHZM commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1283443247 ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { Review Comment: Since this is the only dependency, @gnodet suggests inlining the method, > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17747452#comment-17747452 ] ASF GitHub Bot commented on MNG-7820: - elharo commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1274768736 ## maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java: ## @@ -18,17 +18,48 @@ */ package org.apache.maven.profiles.activation; +import java.util.Locale; + import org.apache.maven.model.Activation; import org.apache.maven.model.ActivationOS; import org.apache.maven.model.Profile; -import org.codehaus.plexus.util.Os; /** * OperatingSystemProfileActivator */ @Deprecated public class OperatingSystemProfileActivator implements ProfileActivator { +public static final String FAMILY_DOS = "dos"; Review Comment: why are these public? especially in a deprecated class? ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { Review Comment: These sorts of methods are very tricky with lots of inobvious, platform dependent edge cases that are hard to get right. I'd be much more comfortable if we could use a single method from commons-io like FileUtils.copyFile ## maven-core/src/main/java/org/apache/maven/utils/introspection/ReflectionValueExtractor.java: ## @@ -0,0 +1,325 @@ +/* + * 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. + */ +package org.apache.maven.utils.introspection; + +import java.lang.ref.WeakReference; +import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; +import java.util.WeakHashMap; + +/** + * + * Using simple dotted expressions to extract the values from an Object instance, For example we might want to extract a + * value like: project.build.sourceDirectory + * + * + * The implementation supports indexed, nested and mapped properties similar to the JSP way. + * + * + * @author mailto:ja...@maven.org";>Jason van Zyl + * @author mailto:vincent.sive...@gmail.com";>Vincent Siveton + * + * @see http://struts.apache.org/1.x/struts-taglib/indexedprops.html";>http://struts.apache.org/1.x/struts-taglib/indexedprops.html + */ +public class ReflectionValueExtractor { Review Comment: non-public if possible ## maven-core/src/main/java/org/apache/maven/utils/dag/Vertex.java: ## @@ -0,0 +1,151 @@ +/* Review Comment: These classes seem to have simply been copied over from plexus. I'm no sure you can simply remove copyright like that but IANAL ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -465,6 +469,28 @@ public void getRemoteFile( } } +private void copyFile(File source, File destination) throws IOException { +String message; Review Comment: declare whrere used, and don't reuse for two different messages ## maven-core/src/main/java/org/apache/maven/utils/dag/CycleDetector.java: ## @@ -0,0 +1,136 @@ +/* + * 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. + */ +package org.apache.ma
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17744891#comment-17744891 ] ASF GitHub Bot commented on MNG-7820: - gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1268959818 ## src/mdo/reader-ex.vm: ## @@ -124,7 +123,7 @@ public class ${className} { * @return ${root.name} */ public ${root.name} read(InputStream in, boolean strict, InputSource source) throws IOException, XmlPullParserException { -return read(ReaderFactory.newXmlReader(in), strict, source); +return read(new XmlStreamReader(in), strict, source); Review Comment: Same here ## src/mdo/reader-modified.vm: ## @@ -135,7 +133,7 @@ public class ${className} { * @return ${root.name} */ public ${root.name} read(InputStream in, boolean strict) throws IOException, XmlPullParserException { -return read(ReaderFactory.newXmlReader(in), strict); +return read(new XmlStreamReader(in), strict); Review Comment: ...here... ## maven-settings-builder/pom.xml: ## @@ -51,17 +51,19 @@ under the License. org.codehaus.plexus plexus-interpolation - - org.codehaus.plexus - plexus-utils - org.apache.maven maven-settings org.codehaus.plexus plexus-sec-dispatcher + Review Comment: The latest code depends on plexus-xml, not plexus-utils. ## src/mdo/reader-modified.vm: ## @@ -148,7 +146,7 @@ public class ${className} { * @return ${root.name} */ public ${root.name} read(InputStream in) throws IOException, XmlPullParserException { -return read(ReaderFactory.newXmlReader(in)); +return read(new XmlStreamReader(in)); Review Comment: here... ## src/mdo/reader-ex.vm: ## @@ -57,7 +57,7 @@ import ${packageModelV4}.InputLocation; #foreach ( $class in $model.allClasses ) import ${packageModelV4}.${class.name}; #end -import org.codehaus.plexus.util.ReaderFactory; +import org.codehaus.plexus.util.xml.XmlStreamReader; Review Comment: We should avoid direct usage of XmlStreamReader and let the parser to its job, passing either the `InputStream` or `Reader`, but not wrapping the object. ## src/mdo/reader.vm: ## @@ -131,7 +129,7 @@ public class ${className} { * @return ${root.name} */ public ${root.name} read(InputStream in) throws IOException, XmlPullParserException { -return read(ReaderFactory.newXmlReader(in)); +return read(new XmlStreamReader(in)); Review Comment: here... ## maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java: ## @@ -25,13 +25,18 @@ import java.io.File; import java.io.IOException; import java.lang.reflect.Method; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; +import org.apache.commons.io.FileUtils; Review Comment: Can we inline the calls to `FileUtils` to not add a dependency to _commons-io_ ? ## maven-compat/pom.xml: ## @@ -93,6 +93,11 @@ under the License. wagon-provider-api + + commons-io + commons-io + Review Comment: I think it should be possible to inline the references to commons-io so that we actually trim down the list of dependencies and not add a new one... ## src/mdo/reader.vm: ## @@ -118,7 +116,7 @@ public class ${className} { * @return ${root.name} */ public ${root.name} read(InputStream in, boolean strict) throws IOException, XmlPullParserException { -return read(ReaderFactory.newXmlReader(in), strict); +return read(new XmlStreamReader(in), strict); Review Comment: here... ## src/mdo/writer.vm: ## @@ -58,7 +58,7 @@ import org.apache.maven.internal.xml.XmlNodeBuilder; #foreach ( $class in $model.allClasses ) import ${packageModelV4}.${class.name}; #end -import org.codehaus.plexus.util.ReaderFactory; +import org.codehaus.plexus.util.xml.XmlStreamReader; Review Comment: This import does not seem to be used, to just remove it. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17744852#comment-17744852 ] ASF GitHub Bot commented on MNG-7820: - CrazyHZM opened a new pull request, #1208: URL: https://github.com/apache/maven/pull/1208 Following this checklist to help us incorporate your contribution quickly and easily: - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MNG) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes. - [ ] Each commit in the pull request should have a meaningful subject line and body. - [ ] Format the pull request title like `[MNG-XXX] SUMMARY`, where you replace `MNG-XXX` and `SUMMARY` with the appropriate JIRA issue. - [ ] Also format the first line of the commit message like `[MNG-XXX] SUMMARY`. Best practice is to use the JIRA issue title in both the pull request title and in the first line of the commit message. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [ ] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [ ] You have run the [Core IT][core-its] successfully. If your pull request is about ~20 lines of code you don't need to sign an [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure please ask on the developers list. To make clear that you license your contribution under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0) you have to acknowledge this by using the following check-box. - [ ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0) - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). [core-its]: https://maven.apache.org/core-its/core-it-suite/ > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17738346#comment-17738346 ] Zhongming Hua commented on MNG-7820: I will wait for this PR to be merged and then complete the issue based on it. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17738067#comment-17738067 ] Guillaume Nodet commented on MNG-7820: -- This will be taken care of by https://github.com/apache/maven/pull/1185 > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17737423#comment-17737423 ] Zhongming Hua commented on MNG-7820: maven-compat and maven-embedder cannot fully remove the dependency on plexus-utils because the *Xpp3Reader* generated by modello relies on the ReaderFactory, I think we may need to replace *ReaderFactory.newXmlReader (in)* with *new XmlStreamReader (in)* in modello-maven-plugin > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17737120#comment-17737120 ] Zhongming Hua commented on MNG-7820: [~gnodet] I checked it and found that the introspection package also needed to be copied to maven-core. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17736987#comment-17736987 ] Guillaume Nodet commented on MNG-7820: -- We don't have any dependency on commons-lang, so I don't think we should add one just for 1 or 2 methods. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17736975#comment-17736975 ] Zhongming Hua commented on MNG-7820: [~gnodet] StringUtils can no longer use common components such as Apache commons? > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17736854#comment-17736854 ] Guillaume Nodet commented on MNG-7820: -- [~crazyhzm] awesome ! the idea is to get rid of {{StringUtils}} by inlining the methods, {{ReaderFactory}} and {{WriterFactory}} by using streams and letting the parser handle the encoding (those are usually used to read files anyway, so using {{Files.newInputStream(...)}} is the best option. The {{diag}} package would have to be completely copied to maven-core I think. Not sure where to put the {{Os}} stuff though, it may be inlined... > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (MNG-7820) Remove dependency on plexus-utils
[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17736848#comment-17736848 ] Zhongming Hua commented on MNG-7820: [~gnodet] I can try to do this. > Remove dependency on plexus-utils > - > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task >Reporter: Guillaume Nodet >Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)