http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/maven-resolver-ant-tasks/src/test/resources/ant/Deploy/ant.xml ---------------------------------------------------------------------- diff --git a/maven-resolver-ant-tasks/src/test/resources/ant/Deploy/ant.xml b/maven-resolver-ant-tasks/src/test/resources/ant/Deploy/ant.xml new file mode 100644 index 0000000..2ad2d7a --- /dev/null +++ b/maven-resolver-ant-tasks/src/test/resources/ant/Deploy/ant.xml @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<!DOCTYPE project [ + <!ENTITY common SYSTEM "../common.xml"> +]> + +<project xmlns:repo="antlib:org.apache.maven.resolver.ant"> + + &common; + + <repo:remoterepo id="distrepo" url="${project.distrepo.url}" type="default" releases="true" snapshots="true" updates="always" checksums="fail"/> + + <target name="setUp"> + <touch file="${project.dir}/dummy-pom.xml"/> + <touch file="${project.dir}/other-pom.xml"/> + <touch file="${project.dir}/ant.xml"/> + </target> + + <target name="testDeployGlobalPom" depends="setUp"> + <repo:pom file="${project.dir}/dummy-pom.xml"/> + <repo:deploy remotereporef="distrepo"/> + </target> + + <target name="testDeployOverrideGlobalPom" depends="setUp"> + <repo:pom file="${project.dir}/dummy-pom.xml"/> + <repo:deploy remotereporef="distrepo"> + <pom file="${project.dir}/other-pom.xml"/> + </repo:deploy> + </target> + + <target name="testDeployOverrideGlobalPomByRef" depends="setUp"> + <repo:pom file="${project.dir}/dummy-pom.xml"/> + <repo:pom file="${project.dir}/other-pom.xml" id="other"/> + <repo:deploy remotereporef="distrepo"/> + <repo:deploy pomref="other" remotereporef="distrepo"/> + </target> + + <target name="testDeployAttachedArtifact" depends="setUp"> + <repo:pom file="${project.dir}/dummy-pom.xml"/> + <repo:artifact classifier="ant" file="${project.dir}/ant.xml" id="ant"/> + <repo:deploy remotereporef="distrepo"> + <repo:artifact refid="ant"/> + </repo:deploy> + </target> + + <target name="testInlineRepo" depends="setUp"> + <repo:localrepo dir="${build.dir}/local-repo-custom" /> + <repo:deploy pomref="pom" remotereporef="distrepo"> + <repo:artifact refid="ant"/> + </repo:deploy> + </target> + +</project>
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/maven-resolver-ant-tasks/src/test/resources/ant/Deploy/dummy-pom.xml ---------------------------------------------------------------------- diff --git a/maven-resolver-ant-tasks/src/test/resources/ant/Deploy/dummy-pom.xml b/maven-resolver-ant-tasks/src/test/resources/ant/Deploy/dummy-pom.xml new file mode 100644 index 0000000..0041f8c --- /dev/null +++ b/maven-resolver-ant-tasks/src/test/resources/ant/Deploy/dummy-pom.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>test</groupId> + <artifactId>dummy</artifactId> + <version>0.1-SNAPSHOT</version> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> +</project> http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/maven-resolver-ant-tasks/src/test/resources/ant/Deploy/other-pom.xml ---------------------------------------------------------------------- diff --git a/maven-resolver-ant-tasks/src/test/resources/ant/Deploy/other-pom.xml b/maven-resolver-ant-tasks/src/test/resources/ant/Deploy/other-pom.xml new file mode 100644 index 0000000..626bede --- /dev/null +++ b/maven-resolver-ant-tasks/src/test/resources/ant/Deploy/other-pom.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>test</groupId> + <artifactId>other</artifactId> + <version>0.1-SNAPSHOT</version> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> +</project> http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/maven-resolver-ant-tasks/src/test/resources/ant/Install/ant.xml ---------------------------------------------------------------------- diff --git a/maven-resolver-ant-tasks/src/test/resources/ant/Install/ant.xml b/maven-resolver-ant-tasks/src/test/resources/ant/Install/ant.xml new file mode 100644 index 0000000..a4bd6eb --- /dev/null +++ b/maven-resolver-ant-tasks/src/test/resources/ant/Install/ant.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<!DOCTYPE project [ + <!ENTITY common SYSTEM "../common.xml"> +]> + +<project xmlns:repo="antlib:org.apache.maven.resolver.ant"> + + &common; + + <repo:pom file="${project.dir}/dummy-pom.xml" id="pom"/> + <repo:artifact classifier="ant" file="${project.dir}/ant.xml" id="ant"/> + + <target name="setUp"> + <touch file="${project.dir}/dummy-pom.xml"/> + <touch file="${project.dir}/other-pom.xml"/> + <touch file="${project.dir}/ant.xml"/> + </target> + + <target name="testInstallGlobalPom" depends="setUp"> + <repo:pom file="${project.dir}/dummy-pom.xml"/> + <repo:install/> + </target> + + <target name="testInstallOverrideGlobalPom" depends="setUp"> + <repo:pom file="${project.dir}/dummy-pom.xml"/> + <repo:install> + <pom file="${project.dir}/other-pom.xml"/> + </repo:install> + </target> + + <target name="testInstallOverrideGlobalPomByRef" depends="setUp"> + <repo:pom file="${project.dir}/dummy-pom.xml"/> + <repo:pom file="${project.dir}/other-pom.xml" id="other"/> + <repo:install/> + <repo:install pomref="other"/> + </target> + + <target name="testDefaultRepo" depends="setUp"> + <repo:install pomref="pom"> + <repo:artifact refid="ant"/> + </repo:install> + </target> + + <target name="testCustomRepo" depends="setUp"> + <repo:localrepo dir="${build.dir}/local-repo-custom" /> + <repo:install pomref="pom"> + <repo:artifact refid="ant"/> + </repo:install> + </target> + +</project> http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/maven-resolver-ant-tasks/src/test/resources/ant/Install/dummy-pom.xml ---------------------------------------------------------------------- diff --git a/maven-resolver-ant-tasks/src/test/resources/ant/Install/dummy-pom.xml b/maven-resolver-ant-tasks/src/test/resources/ant/Install/dummy-pom.xml new file mode 100644 index 0000000..0041f8c --- /dev/null +++ b/maven-resolver-ant-tasks/src/test/resources/ant/Install/dummy-pom.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>test</groupId> + <artifactId>dummy</artifactId> + <version>0.1-SNAPSHOT</version> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> +</project> http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/maven-resolver-ant-tasks/src/test/resources/ant/Install/other-pom.xml ---------------------------------------------------------------------- diff --git a/maven-resolver-ant-tasks/src/test/resources/ant/Install/other-pom.xml b/maven-resolver-ant-tasks/src/test/resources/ant/Install/other-pom.xml new file mode 100644 index 0000000..626bede --- /dev/null +++ b/maven-resolver-ant-tasks/src/test/resources/ant/Install/other-pom.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>test</groupId> + <artifactId>other</artifactId> + <version>0.1-SNAPSHOT</version> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> +</project> http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/maven-resolver-ant-tasks/src/test/resources/ant/Reactor/ant.xml ---------------------------------------------------------------------- diff --git a/maven-resolver-ant-tasks/src/test/resources/ant/Reactor/ant.xml b/maven-resolver-ant-tasks/src/test/resources/ant/Reactor/ant.xml new file mode 100644 index 0000000..7b7976a --- /dev/null +++ b/maven-resolver-ant-tasks/src/test/resources/ant/Reactor/ant.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<!DOCTYPE project [ + <!ENTITY common SYSTEM "../common.xml"> +]> + +<project xmlns:repo="antlib:org.apache.maven.resolver.ant"> + + &common; + + <target name="testPom"> + <repo:pom file="${project.dir}/pom1.xml"/> + </target> + + <target name="testArtifact"> + <repo:pom file="${project.dir}/pom1.xml" id="pom"/> + <repo:artifact pomref="pom" file="${project.dir}/pom1.xml"/> + </target> + + <target name="testArtifactInMemoryPom"> + <repo:pom groupid="test" artifactid="test" version="0.1-SNAPSHOT" id="pom"/> + <repo:artifact pomref="pom" file="${project.dir}/pom1.xml"/> + </target> + + <target name="testResolveArtifact"> + <repo:pom file="${project.dir}/pom1.xml" id="pom"/> + <repo:artifact pomref="pom" file="${project.dir}/pom1.xml" type="jar"/> + <repo:pom file="${project.dir}/pom2.xml" id="pom2"/> + + <repo:resolve> + <dependencies pomref="pom2"/> + <properties prefix="resolve"/> + </repo:resolve> + </target> + + <target name="testResolveArtifactInMemoryPom"> + <repo:pom groupid="test" artifactid="test" version="0.1-SNAPSHOT" id="pom"/> + <repo:artifact pomref="pom" file="${project.dir}/pom1.xml" type="jar"/> + <repo:pom file="${project.dir}/pom2.xml" id="pom2"/> + + <repo:resolve> + <dependencies pomref="pom2"/> + <properties prefix="resolve"/> + </repo:resolve> + </target> + + <target name="testResolveVersionRange"> + <repo:pom file="${project.dir}/pom1.xml" id="pom"/> + <repo:artifact pomref="pom" file="${project.dir}/pom1.xml" type="jar"/> + + <repo:resolve> + <dependencies> + <dependency groupId="test" artifactId="test" version="[0,)"/> + </dependencies> + <properties prefix="resolve"/> + </repo:resolve> + </target> + +</project> http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/maven-resolver-ant-tasks/src/test/resources/ant/Reactor/pom1.xml ---------------------------------------------------------------------- diff --git a/maven-resolver-ant-tasks/src/test/resources/ant/Reactor/pom1.xml b/maven-resolver-ant-tasks/src/test/resources/ant/Reactor/pom1.xml new file mode 100644 index 0000000..84496ca --- /dev/null +++ b/maven-resolver-ant-tasks/src/test/resources/ant/Reactor/pom1.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>test</groupId> + <artifactId>test</artifactId> + <version>0.1-SNAPSHOT</version> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> +</project> http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/maven-resolver-ant-tasks/src/test/resources/ant/Reactor/pom2.xml ---------------------------------------------------------------------- diff --git a/maven-resolver-ant-tasks/src/test/resources/ant/Reactor/pom2.xml b/maven-resolver-ant-tasks/src/test/resources/ant/Reactor/pom2.xml new file mode 100644 index 0000000..e0d5be6 --- /dev/null +++ b/maven-resolver-ant-tasks/src/test/resources/ant/Reactor/pom2.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>test</groupId> + <artifactId>test2</artifactId> + <version>0.1-SNAPSHOT</version> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <dependencies> + <dependency> + <groupId>test</groupId> + <artifactId>test</artifactId> + <version>0.1-SNAPSHOT</version> + </dependency> + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/maven-resolver-ant-tasks/src/test/resources/ant/Resolve/ant.xml ---------------------------------------------------------------------- diff --git a/maven-resolver-ant-tasks/src/test/resources/ant/Resolve/ant.xml b/maven-resolver-ant-tasks/src/test/resources/ant/Resolve/ant.xml new file mode 100644 index 0000000..4565ea7 --- /dev/null +++ b/maven-resolver-ant-tasks/src/test/resources/ant/Resolve/ant.xml @@ -0,0 +1,122 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<!DOCTYPE project [ + <!ENTITY common SYSTEM "../common.xml"> +]> + +<project xmlns:repo="antlib:org.apache.maven.resolver.ant"> + + &common; + + <repo:remoterepo id="remote" url="http://repo1.maven.org/maven2" type="default" releases="true" snapshots="true" updates="always" checksums="fail"/> + <repo:remoterepos id="resolver.repositories"> + <repo:remoterepo refid="remote"/> + </repo:remoterepos> + + <target name="setUp"> + <delete dir="${build.dir}/resolvetest-local-repo"/> + </target> + + <target name="testResolveGlobalPom"> + <repo:pom file="${project.dir}/pom.xml"/> + <repo:resolve> + <properties prefix="test.resolve.path" classpath="compile"/> + </repo:resolve> + </target> + + <target name="testResolveOverrideGlobalPom"> + <repo:pom file="${project.dir}/dummy-pom.xml"/> + <repo:resolve> + <dependencies> + <pom file="${project.dir}/pom.xml"/> + </dependencies> + <properties prefix="test.resolve.path" classpath="compile"/> + </repo:resolve> + </target> + + <target name="testResolveGlobalPomIntoOtherLocalRepo"> + <repo:localrepo dir="${build.dir}/local-repo-custom"/> + <repo:pom file="${project.dir}/pom.xml"/> + <repo:resolve> + <properties prefix="test.resolve.path" classpath="compile"/> + </repo:resolve> + </target> + + <target name="testResolveCustomFileLayout"> + <repo:pom file="${project.dir}/pom.xml"/> + <repo:resolve> + <files dir="${build.dir}/resolve-custom-layout/" layout="{groupId}/{artifactId}/{groupIdDirs}/{extension}"/> + </repo:resolve> + </target> + + <target name="testResolveAttachments"> + <repo:resolve> + <dependencies> + <dependency groupid="org.eclipse.aether" artifactid="aether-impl" version="0.9.0.v20140226" /> + </dependencies> + <files dir="${build.dir}/resolve-attachments/" layout="javadoc/{groupId}-{artifactId}-{classifier}.{extension}" attachments="javadoc"/> + <files dir="${build.dir}/resolve-attachments/" layout="sources/{groupId}-{artifactId}-{classifier}.{extension}" attachments="sources"/> + </repo:resolve> + </target> + + <target name="testResolvePath"> + <repo:pom file="${project.dir}/pom.xml"/> + <repo:resolve> + <path refid="out" classpath="compile"/> + </repo:resolve> + <echo>${tostring:out}</echo> + </target> + + <target name="testResolveDepsFromFile"> + <repo:resolve> + <dependencies file="${project.dir}/dependencies.txt"> + <exclusion coords="org.eclipse.aether:aether-api"/> + </dependencies> + <properties prefix="test.resolve.path" classpath="runtime"/> + </repo:resolve> + </target> + + <target name="testResolveNestedDependencyCollections"> + <repo:resolve> + <dependencies> + <dependencies> + <dependency groupid="org.eclipse.aether" artifactid="aether-spi" version="0.9.0.v20140226" /> + </dependencies> + <dependencies> + <dependency groupid="org.eclipse.aether" artifactid="aether-util" version="0.9.0.v20140226" /> + </dependencies> + <exclusion coords="org.eclipse.aether:aether-api"/> + </dependencies> + <properties prefix="test.resolve.path" classpath="runtime"/> + </repo:resolve> + </target> + + <target name="testResolveResourceCollectionOnly"> + <repo:resolve> + <dependencies> + <dependency groupid="org.eclipse.aether" artifactid="aether-spi" version="0.9.0.v20140226" /> + </dependencies> + <files refid="files"/> + </repo:resolve> + </target> + +</project> http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/maven-resolver-ant-tasks/src/test/resources/ant/Resolve/dependencies.txt ---------------------------------------------------------------------- diff --git a/maven-resolver-ant-tasks/src/test/resources/ant/Resolve/dependencies.txt b/maven-resolver-ant-tasks/src/test/resources/ant/Resolve/dependencies.txt new file mode 100644 index 0000000..8254bb3 --- /dev/null +++ b/maven-resolver-ant-tasks/src/test/resources/ant/Resolve/dependencies.txt @@ -0,0 +1,11 @@ +# +# Copyright (c) 2014 Sonatype, Inc. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# + +# each line specifies one dependency +org.eclipse.aether:aether-spi:0.9.0.v20140226:runtime # a comment + http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/maven-resolver-ant-tasks/src/test/resources/ant/Resolve/dummy-pom.xml ---------------------------------------------------------------------- diff --git a/maven-resolver-ant-tasks/src/test/resources/ant/Resolve/dummy-pom.xml b/maven-resolver-ant-tasks/src/test/resources/ant/Resolve/dummy-pom.xml new file mode 100644 index 0000000..75bc291 --- /dev/null +++ b/maven-resolver-ant-tasks/src/test/resources/ant/Resolve/dummy-pom.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>test</groupId> + <artifactId>test</artifactId> + <version>0.1-SNAPSHOT</version> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> +</project> http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/maven-resolver-ant-tasks/src/test/resources/ant/Resolve/pom.xml ---------------------------------------------------------------------- diff --git a/maven-resolver-ant-tasks/src/test/resources/ant/Resolve/pom.xml b/maven-resolver-ant-tasks/src/test/resources/ant/Resolve/pom.xml new file mode 100644 index 0000000..392974d --- /dev/null +++ b/maven-resolver-ant-tasks/src/test/resources/ant/Resolve/pom.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.sonatype.forge</groupId> + <artifactId>forge-parent</artifactId> + <version>10</version> + </parent> + + <groupId>org.eclipse.aether</groupId> + <artifactId>aether-ant-tasks</artifactId> + <version>1.0-SNAPSHOT</version> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <aetherVersion>0.9.0.M3</aetherVersion> + </properties> + + <dependencies> + <dependency> + <groupId>org.eclipse.aether</groupId> + <artifactId>aether-api</artifactId> + <version>${aetherVersion}</version> + </dependency> + <dependency> + <groupId>org.eclipse.aether</groupId> + <artifactId>aether-system</artifactId> + <version>${aetherVersion}</version> + <type>pom</type> + <scope>system</scope> + <systemPath>${basedir}/pom.xml</systemPath> + </dependency> + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/maven-resolver-ant-tasks/src/test/resources/ant/Settings/ant.xml ---------------------------------------------------------------------- diff --git a/maven-resolver-ant-tasks/src/test/resources/ant/Settings/ant.xml b/maven-resolver-ant-tasks/src/test/resources/ant/Settings/ant.xml new file mode 100644 index 0000000..8c1f79a --- /dev/null +++ b/maven-resolver-ant-tasks/src/test/resources/ant/Settings/ant.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<!DOCTYPE project [ + <!ENTITY common SYSTEM "../common.xml"> +]> + +<project xmlns:repo="antlib:org.apache.maven.resolver.ant"> + + &common; + + <target name="setUp"> + <!-- touch file="${project.dir}/common.xml"/--> + </target> + + <target name="testUserSettings" depends="setUp"> + <repo:settings file="userSettings.xml"/> + </target> + + <target name="testGlobalSettings" depends="setUp"> + <repo:settings globalfile="globalSettings.xml"/> + </target> + + <target name="testBothSettings" depends="setUp"> + <repo:settings file="userSettings.xml" globalfile="globalSettings.xml"/> + </target> + +</project> http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/maven-resolver-ant-tasks/src/test/resources/ant/common.xml ---------------------------------------------------------------------- diff --git a/maven-resolver-ant-tasks/src/test/resources/ant/common.xml b/maven-resolver-ant-tasks/src/test/resources/ant/common.xml new file mode 100644 index 0000000..02c0a57 --- /dev/null +++ b/maven-resolver-ant-tasks/src/test/resources/ant/common.xml @@ -0,0 +1,20 @@ +<!-- + 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. +--> + +<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml"/> http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 85edc0d..0000000 --- a/pom.xml +++ /dev/null @@ -1,364 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - 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. ---> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.maven</groupId> - <artifactId>maven-parent</artifactId> - <version>30</version> - <relativePath>../pom/maven/pom.xml</relativePath> - </parent> - - <groupId>org.apache.maven.resolver</groupId> - <artifactId>maven-resolver-ant-tasks</artifactId> - <version>1.1.0-SNAPSHOT</version> - - <name>Maven Artifact Resolver Ant Tasks</name> - <description> - Ant tasks handling Maven artifacts using Maven Artifact Resolver and Maven Artifact Resolver Provider. - </description> - <url>https://maven.apache.org/resolver-ant-tasks/</url> - <inceptionYear>2010</inceptionYear> - - <scm> - <connection>scm:git:https://git-wip-us.apache.org/repos/asf/maven-resolver.git</connection> - <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/maven-resolver.git</developerConnection> - <url>https://github.com/apache/maven-resolver/tree/${project.scm.tag}</url> - <tag>ant-tasks</tag> - </scm> - <issueManagement> - <system>jira</system> - <url>https://issues.apache.org/jira/browse/MRESOLVER</url> - </issueManagement> - <ciManagement> - <system>Jenkins</system> - <url>https://builds.apache.org/job/maven-resolver-ant-tasks</url> - </ciManagement> - <distributionManagement> - <site> - <id>apache.website</id> - <url>scm:svn:https://svn.apache.org/repos/infra/websites/production/maven/components/${maven.site.path}</url> - </site> - </distributionManagement> - - <properties> - <mavenVersion>3.5.0</mavenVersion> - <resolverVersion>1.0.3</resolverVersion> - <javaVersion>7</javaVersion> - <maven.site.path>resolver-archives/resolver-ant-tasks-LATEST</maven.site.path> - <checkstyle.violation.ignore>LineLength,MagicNumber</checkstyle.violation.ignore> - </properties> - - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-utils</artifactId> - <version>3.0.24</version> - </dependency> - <dependency> - <groupId>org.sonatype.plexus</groupId> - <artifactId>plexus-cipher</artifactId> - <version>1.7</version> - </dependency> - </dependencies> - </dependencyManagement> - - <dependencies> - <dependency> - <!-- NOTE: The target runtime is actually Ant 1.7+ but for compilation we need some newer APIs --> - <groupId>org.apache.ant</groupId> - <artifactId>ant</artifactId> - <version>1.8.2</version> - <scope>provided</scope> - <exclusions> - <exclusion> - <groupId>org.apache.ant</groupId> - <artifactId>ant-launcher</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.maven.resolver</groupId> - <artifactId>maven-resolver-api</artifactId> - <version>${resolverVersion}</version> - </dependency> - <dependency> - <groupId>org.apache.maven.resolver</groupId> - <artifactId>maven-resolver-util</artifactId> - <version>${resolverVersion}</version> - </dependency> - <dependency> - <groupId>org.apache.maven.resolver</groupId> - <artifactId>maven-resolver-impl</artifactId> - <version>${resolverVersion}</version> - </dependency> - <dependency> - <groupId>org.apache.maven.resolver</groupId> - <artifactId>maven-resolver-connector-basic</artifactId> - <version>${resolverVersion}</version> - </dependency> - <dependency> - <groupId>org.apache.maven.resolver</groupId> - <artifactId>maven-resolver-transport-classpath</artifactId> - <version>${resolverVersion}</version> - </dependency> - <dependency> - <groupId>org.apache.maven.resolver</groupId> - <artifactId>maven-resolver-transport-file</artifactId> - <version>${resolverVersion}</version> - </dependency> - <dependency> - <groupId>org.apache.maven.resolver</groupId> - <artifactId>maven-resolver-transport-http</artifactId> - <version>${resolverVersion}</version> - </dependency> - <dependency> - <!-- This shuts off annoying warnings from slf4j-api --> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-nop</artifactId> - <version>1.6.2</version> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-resolver-provider</artifactId> - <version>${mavenVersion}</version> - <exclusions> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-component-annotations</artifactId> - </exclusion> - <exclusion> - <groupId>org.eclipse.sisu</groupId> - <artifactId>org.eclipse.sisu.plexus</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-settings-builder</artifactId> - <version>${mavenVersion}</version> - <exclusions> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-component-annotations</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-component-annotations</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-interpolation</artifactId> - <version>1.16</version> - </dependency> - <dependency> - <groupId>org.eclipse.sisu</groupId> - <artifactId>org.eclipse.sisu.plexus</artifactId> - <version>0.1.1</version> - <exclusions> - <exclusion> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </exclusion> - <exclusion> - <groupId>javax.enterprise</groupId> - <artifactId>cdi-api</artifactId> - </exclusion> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-classworlds</artifactId> - </exclusion> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-utils</artifactId> - </exclusion> - <exclusion> - <groupId>org.eclipse.sisu</groupId> - <artifactId>org.eclipse.sisu.inject</artifactId> - </exclusion> - <exclusion> - <groupId>org.sonatype.sisu</groupId> - <artifactId>sisu-guice</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.11</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.ant</groupId> - <artifactId>ant-testutil</artifactId> - <version>1.8.2</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.ant</groupId> - <artifactId>ant-launcher</artifactId> - <version>1.8.2</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-library</artifactId> - <version>1.3</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-core</artifactId> - <version>1.3</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.maven.resolver</groupId> - <artifactId>maven-resolver-test-util</artifactId> - <version>${resolverVersion}</version> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.rat</groupId> - <artifactId>apache-rat-plugin</artifactId> - <configuration> - <excludes combine.children="append"> - <exclude>src/test/resources/**/*.txt</exclude> - <exclude>README.md</exclude> - <exclude>src/site/markdown/**/*.md.vm</exclude> - </excludes> - </configuration> - </plugin> - <plugin> - <artifactId>maven-shade-plugin</artifactId> - <version>2.4.3</version> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <createDependencyReducedPom>false</createDependencyReducedPom> - <shadedArtifactAttached>true</shadedArtifactAttached> - <shadedClassifierName>uber</shadedClassifierName> - <filters> - <filter> - <artifact>org.eclipse.sisu:org.eclipse.sisu.plexus</artifact> - <includes> - <include>org/codehaus/plexus/logging/*LogEnabled*</include> - <include>org/codehaus/plexus/logging/Logger*</include> - </includes> - </filter> - <filter> - <artifact>*:*</artifact> - <excludes> - <exclude>licenses/**</exclude> - </excludes> - </filter> - </filters> - <transformers> - <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer" /> - </transformers> - <relocations> - <relocation> - <pattern>org.eclipse.aether</pattern> - <shadedPattern>org.apache.maven.resolver.internal.ant.org.eclipse.aether</shadedPattern> - <excludes> - <exclude>org.eclipse.aether.ant.**</exclude> - </excludes> - </relocation> - <relocation> - <pattern>org.sonatype.plexus</pattern> - <shadedPattern>org.apache.maven.resolver.internal.ant.org.sonatype.plexus</shadedPattern> - </relocation> - <relocation> - <pattern>org.apache</pattern> - <shadedPattern>org.apache.maven.resolver.internal.ant.org.apache</shadedPattern> - <excludes> - <exclude>org.apache.tools.**</exclude> - <exclude>org.apache.maven.aether.**</exclude> - </excludes> - </relocation> - <relocation> - <pattern>org.codehaus</pattern> - <shadedPattern>org.apache.maven.resolver.internal.ant.org.codehaus</shadedPattern> - </relocation> - <relocation> - <pattern>org.slf4j</pattern> - <shadedPattern>org.apache.maven.resolver.internal.ant.org.slf4j</shadedPattern> - </relocation> - </relocations> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - - <profiles> - <profile> - <id>run-its</id> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> - <version>1.6</version> - <executions> - <execution> - <id>smoke-test</id> - <phase>integration-test</phase> - <goals> - <goal>run</goal> - </goals> - <configuration> - <target> - <ant antfile="build.xml" /> - </target> - </configuration> - </execution> - </executions> - <dependencies> - <dependency> - <groupId>org.apache.ant</groupId> - <artifactId>ant-junit</artifactId> - <version>1.8.2</version> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> - </profile> - </profiles> -</project> http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/src/main/assembly/bin.xml ---------------------------------------------------------------------- diff --git a/src/main/assembly/bin.xml b/src/main/assembly/bin.xml deleted file mode 100644 index a2df39b..0000000 --- a/src/main/assembly/bin.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - 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. ---> - -<assembly> - <id>bin</id> - <formats> - <format>zip</format> - </formats> - <fileSets> - <fileSet> - <directory>target</directory> - <outputDirectory>.</outputDirectory> - <includes> - <include>*-uber.jar</include> - <include>*-uber.jar.asc</include> - </includes> - <excludes> - <exclude>*-sources.*</exclude> - <exclude>*-javadoc.*</exclude> - </excludes> - </fileSet> - <fileSet> - <directory>.</directory> - <includes> - <include>*.html</include> - </includes> - </fileSet> - </fileSets> -</assembly> http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/src/main/java/org/apache/maven/resolver/internal/ant/AetherUtils.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/maven/resolver/internal/ant/AetherUtils.java b/src/main/java/org/apache/maven/resolver/internal/ant/AetherUtils.java deleted file mode 100644 index 6b59f90..0000000 --- a/src/main/java/org/apache/maven/resolver/internal/ant/AetherUtils.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.apache.maven.resolver.internal.ant; - -/* - * 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. - */ - -import java.io.File; - -import org.apache.maven.resolver.internal.ant.types.RemoteRepositories; -import org.apache.tools.ant.Project; - -class AetherUtils -{ - - public static File findGlobalSettings( Project project ) - { - File file = new File( new File( project.getProperty( "ant.home" ), "etc" ), Names.SETTINGS_XML ); - if ( file.isFile() ) - { - return file; - } - else - { - String mavenHome = getMavenHome( project ); - if ( mavenHome != null ) - { - return new File( new File( mavenHome, "conf" ), Names.SETTINGS_XML ); - } - } - - return null; - } - - public static String getMavenHome( Project project ) - { - String mavenHome = project.getProperty( "maven.home" ); - if ( mavenHome != null ) - { - return mavenHome; - } - return System.getenv( "M2_HOME" ); - } - - public static File findUserSettings( Project project ) - { - File userHome = new File( project.getProperty( "user.home" ) ); - File file = new File( new File( userHome, ".ant" ), Names.SETTINGS_XML ); - if ( file.isFile() ) - { - return file; - } - else - { - return new File( new File( userHome, ".m2" ), Names.SETTINGS_XML ); - } - } - - public static RemoteRepositories getDefaultRepositories( Project project ) - { - Object obj = project.getReference( Names.ID_DEFAULT_REPOS ); - if ( obj instanceof RemoteRepositories ) - { - return (RemoteRepositories) obj; - } - return null; - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/src/main/java/org/apache/maven/resolver/internal/ant/AntLogger.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/maven/resolver/internal/ant/AntLogger.java b/src/main/java/org/apache/maven/resolver/internal/ant/AntLogger.java deleted file mode 100644 index 711d653..0000000 --- a/src/main/java/org/apache/maven/resolver/internal/ant/AntLogger.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.apache.maven.resolver.internal.ant; - -/* - * 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. - */ - -import org.apache.tools.ant.Project; -import org.eclipse.aether.spi.log.Logger; - -/** - */ -class AntLogger - implements Logger -{ - - private Project project; - - public AntLogger( Project project ) - { - this.project = project; - } - - public void debug( String msg ) - { - project.log( msg, Project.MSG_DEBUG ); - } - - public void debug( String msg, Throwable error ) - { - project.log( msg, error, Project.MSG_DEBUG ); - } - - public boolean isDebugEnabled() - { - return true; - } - - public boolean isWarnEnabled() - { - return true; - } - - public void warn( String msg ) - { - project.log( msg, Project.MSG_WARN ); - } - - public void warn( String msg, Throwable error ) - { - project.log( msg, error, Project.MSG_WARN ); - } - -} http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/a088cdfc/src/main/java/org/apache/maven/resolver/internal/ant/AntModelResolver.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/maven/resolver/internal/ant/AntModelResolver.java b/src/main/java/org/apache/maven/resolver/internal/ant/AntModelResolver.java deleted file mode 100644 index 43b64f7..0000000 --- a/src/main/java/org/apache/maven/resolver/internal/ant/AntModelResolver.java +++ /dev/null @@ -1,180 +0,0 @@ -package org.apache.maven.resolver.internal.ant; - -/* - * 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. - */ - -import java.io.File; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.apache.maven.model.Dependency; -import org.apache.maven.model.Parent; -import org.apache.maven.model.Repository; -import org.apache.maven.model.building.FileModelSource; -import org.apache.maven.model.building.ModelSource; -import org.apache.maven.model.resolution.InvalidRepositoryException; -import org.apache.maven.model.resolution.ModelResolver; -import org.apache.maven.model.resolution.UnresolvableModelException; -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.artifact.DefaultArtifact; -import org.eclipse.aether.impl.RemoteRepositoryManager; -import org.eclipse.aether.repository.RemoteRepository; -import org.eclipse.aether.repository.RepositoryPolicy; -import org.eclipse.aether.resolution.ArtifactRequest; -import org.eclipse.aether.resolution.ArtifactResolutionException; - -/** - * A model resolver to assist building of dependency POMs. This resolver gives priority to those repositories that have - * been initially specified and repositories discovered in dependency POMs are recessively merged into the search chain. - * - */ -class AntModelResolver - implements ModelResolver -{ - - private final RepositorySystemSession session; - - private final String context; - - private List<org.eclipse.aether.repository.RemoteRepository> repositories; - - private final RepositorySystem repoSys; - - private final RemoteRepositoryManager remoteRepositoryManager; - - private final Set<String> repositoryIds; - - public AntModelResolver( RepositorySystemSession session, String context, RepositorySystem repoSys, - RemoteRepositoryManager remoteRepositoryManager, List<RemoteRepository> repositories ) - { - this.session = session; - this.context = context; - this.repoSys = repoSys; - this.remoteRepositoryManager = remoteRepositoryManager; - this.repositories = repositories; - this.repositoryIds = new HashSet<String>(); - } - - private AntModelResolver( AntModelResolver original ) - { - this.session = original.session; - this.context = original.context; - this.repoSys = original.repoSys; - this.remoteRepositoryManager = original.remoteRepositoryManager; - this.repositories = original.repositories; - this.repositoryIds = new HashSet<String>( original.repositoryIds ); - } - - public void addRepository( Repository repository ) - throws InvalidRepositoryException - { - if ( !repositoryIds.add( repository.getId() ) ) - { - return; - } - - List<RemoteRepository> newRepositories = Collections.singletonList( convert( repository ) ); - - this.repositories = - remoteRepositoryManager.aggregateRepositories( session, repositories, newRepositories, true ); - } - - static RemoteRepository convert( Repository repository ) - { - RemoteRepository.Builder builder = - new RemoteRepository.Builder( repository.getId(), repository.getLayout(), repository.getUrl() ); - builder.setSnapshotPolicy( convert( repository.getSnapshots() ) ); - builder.setReleasePolicy( convert( repository.getReleases() ) ); - return builder.build(); - } - - private static RepositoryPolicy convert( org.apache.maven.model.RepositoryPolicy policy ) - { - boolean enabled = true; - String checksums = RepositoryPolicy.CHECKSUM_POLICY_WARN; - String updates = RepositoryPolicy.UPDATE_POLICY_DAILY; - - if ( policy != null ) - { - enabled = policy.isEnabled(); - if ( policy.getUpdatePolicy() != null ) - { - updates = policy.getUpdatePolicy(); - } - if ( policy.getChecksumPolicy() != null ) - { - checksums = policy.getChecksumPolicy(); - } - } - - return new RepositoryPolicy( enabled, updates, checksums ); - } - - public ModelResolver newCopy() - { - return new AntModelResolver( this ); - } - - public ModelSource resolveModel( String groupId, String artifactId, String version ) - throws UnresolvableModelException - { - Artifact pomArtifact = new DefaultArtifact( groupId, artifactId, "", "pom", version ); - - try - { - ArtifactRequest request = new ArtifactRequest( pomArtifact, repositories, context ); - pomArtifact = repoSys.resolveArtifact( session, request ).getArtifact(); - } - catch ( ArtifactResolutionException e ) - { - throw new UnresolvableModelException( "Failed to resolve POM for " + groupId + ":" + artifactId + ":" - + version + " due to " + e.getMessage(), groupId, artifactId, version, e ); - } - - File pomFile = pomArtifact.getFile(); - - return new FileModelSource( pomFile ); - } - - @Override - public ModelSource resolveModel( Parent parent ) - throws UnresolvableModelException - { - return resolveModel( parent.getGroupId(), parent.getArtifactId(), parent.getVersion() ); - } - - @Override - public ModelSource resolveModel( Dependency dependency ) - throws UnresolvableModelException - { - return resolveModel( dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion() ); - } - - @Override - public void addRepository( Repository repository, boolean replace ) - throws InvalidRepositoryException - { - addRepository( repository ); - } - -}