Modified: incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/resolve/ExtractNuspecFromPackagesMojo.java URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/resolve/ExtractNuspecFromPackagesMojo.java?rev=1619666&r1=1619665&r2=1619666&view=diff ============================================================================== --- incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/resolve/ExtractNuspecFromPackagesMojo.java (original) +++ incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/resolve/ExtractNuspecFromPackagesMojo.java Fri Aug 22 05:17:20 2014 @@ -1,119 +1,119 @@ -/* - * 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 npanday.plugin.libraryimporter.resolve; - -import npanday.plugin.libraryimporter.model.NugetPackage; -import npanday.plugin.libraryimporter.skeletons.AbstractHandleEachImportMojo; -import npanday.plugin.libraryimporter.skeletons.AbstractLibraryImportsProvidingMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.codehaus.plexus.util.IOUtil; - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -/** - * Extract nuspec files from resolved Nuget packages. - * - * @author <a href="mailto:lcornelius...@apache.org">Lars Corneliussen</a> - * @goal extract-nuspec - */ -public class ExtractNuspecFromPackagesMojo - extends AbstractHandleEachImportMojo -{ - @Override - protected void handleNugetPackage( NugetPackage nuget ) throws MojoExecutionException, MojoFailureException - { - FileInputStream zipFile = null; - try - { - zipFile = new FileInputStream( nuget.getPackageFile().getAbsolutePath() ); - ZipInputStream zip = new ZipInputStream( zipFile ); - ZipEntry ze; - - String foundSpec = null; - - while ( ( ze = zip.getNextEntry() ) != null ) - { - if ( ze.getName().endsWith( ".nuspec" ) ) - { - foundSpec = ze.getName(); - - byte[] buf = new byte[1024]; - - FileOutputStream fileoutputstream = null; - try - { - fileoutputstream = new FileOutputStream( nuget.getNuspecFile().getAbsolutePath() ); - - int n; - while ( ( n = zip.read( buf, 0, 1024 ) ) > -1 ) - { - fileoutputstream.write( buf, 0, n ); - } - } - finally - { - IOUtil.close( fileoutputstream ); - } - - break; - } - } - - if ( foundSpec == null ) - { - throw new MojoExecutionException( - "NPANDAY-139-004: Could not find nuspec in package file " + nuget.getPackageFile() - ); - } - else - { - if ( getLog().isDebugEnabled() ) - { - getLog().debug( - "NPANDAY-139-005: found nuspec " + foundSpec + " and extracted to " + nuget.getNuspecFile() - ); - } - } - } - catch ( FileNotFoundException e ) - { - throw new MojoExecutionException( - "NPANDAY-139-001: Could not find package file " + nuget.getPackageFile().getAbsolutePath() - ); - } - catch ( IOException e ) - { - throw new MojoExecutionException( - "NPANDAY-139-003: Error on reading or extracting zip contents of " + nuget.getPackageFile() - ); - } - finally - { - IOUtil.close( zipFile ); - } - } - -} +/* + * 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 npanday.plugin.libraryimporter.resolve; + +import npanday.plugin.libraryimporter.model.NugetPackage; +import npanday.plugin.libraryimporter.skeletons.AbstractHandleEachImportMojo; +import npanday.plugin.libraryimporter.skeletons.AbstractLibraryImportsProvidingMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.codehaus.plexus.util.IOUtil; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +/** + * Extract nuspec files from resolved Nuget packages. + * + * @author <a href="mailto:lcornelius...@apache.org">Lars Corneliussen</a> + * @goal extract-nuspec + */ +public class ExtractNuspecFromPackagesMojo + extends AbstractHandleEachImportMojo +{ + @Override + protected void handleNugetPackage( NugetPackage nuget ) throws MojoExecutionException, MojoFailureException + { + FileInputStream zipFile = null; + try + { + zipFile = new FileInputStream( nuget.getPackageFile().getAbsolutePath() ); + ZipInputStream zip = new ZipInputStream( zipFile ); + ZipEntry ze; + + String foundSpec = null; + + while ( ( ze = zip.getNextEntry() ) != null ) + { + if ( ze.getName().endsWith( ".nuspec" ) ) + { + foundSpec = ze.getName(); + + byte[] buf = new byte[1024]; + + FileOutputStream fileoutputstream = null; + try + { + fileoutputstream = new FileOutputStream( nuget.getNuspecFile().getAbsolutePath() ); + + int n; + while ( ( n = zip.read( buf, 0, 1024 ) ) > -1 ) + { + fileoutputstream.write( buf, 0, n ); + } + } + finally + { + IOUtil.close( fileoutputstream ); + } + + break; + } + } + + if ( foundSpec == null ) + { + throw new MojoExecutionException( + "NPANDAY-139-004: Could not find nuspec in package file " + nuget.getPackageFile() + ); + } + else + { + if ( getLog().isDebugEnabled() ) + { + getLog().debug( + "NPANDAY-139-005: found nuspec " + foundSpec + " and extracted to " + nuget.getNuspecFile() + ); + } + } + } + catch ( FileNotFoundException e ) + { + throw new MojoExecutionException( + "NPANDAY-139-001: Could not find package file " + nuget.getPackageFile().getAbsolutePath() + ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( + "NPANDAY-139-003: Error on reading or extracting zip contents of " + nuget.getPackageFile() + ); + } + finally + { + IOUtil.close( zipFile ); + } + } + +}
Propchange: incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/resolve/ExtractNuspecFromPackagesMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/resolve/GeneratePackageManifestInfosMojo.java URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/resolve/GeneratePackageManifestInfosMojo.java?rev=1619666&r1=1619665&r2=1619666&view=diff ============================================================================== --- incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/resolve/GeneratePackageManifestInfosMojo.java (original) +++ incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/resolve/GeneratePackageManifestInfosMojo.java Fri Aug 22 05:17:20 2014 @@ -1,121 +1,121 @@ -/* - * 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 npanday.plugin.libraryimporter.resolve; - -import com.google.common.collect.Lists; -import npanday.PlatformUnsupportedException; -import npanday.executable.ExecutableRequirement; -import npanday.executable.ExecutionException; -import npanday.executable.NetExecutable; -import npanday.plugin.libraryimporter.model.NugetPackage; -import npanday.plugin.libraryimporter.skeletons.AbstractHandleEachImportMojo; -import npanday.plugin.libraryimporter.skeletons.AbstractLibraryImportsProvidingMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; - -import java.io.File; - -/** - * Generate manifest-info for each. - * - * @author <a href="mailto:lcornelius...@apache.org">Lars Corneliussen</a> - * @goal generate-package-manifestinfos - */ -public class GeneratePackageManifestInfosMojo - extends AbstractHandleEachImportMojo -{ - /** - * The executable identifier used to locate the right configurations from executable-plugins.xml. Can't be changed. - */ - private String executableIdentifier = "MANIFESTINFO"; - - /** - * The configured executable version, from executable-plugins.xml, to be used. Should align to a installed - * Azure SDK version. - * - * @parameter expression="${nuget.version}" default-value="1.0" - */ - private String executableVersion; - - /** - * The configured executable profile, from executable-plugins.xml, to be used. - * - * @parameter expression="${nuget.profile}" - */ - private String executableProfile; - - protected ExecutableRequirement getExecutableRequirement() - { - // TODO: profile is actually an identifier; the real profile has yet to be supported - return new ExecutableRequirement( getVendorRequirement(), executableIdentifier, executableVersion ); - } - - @Override - protected void handleNugetPackage( NugetPackage nuget ) throws MojoExecutionException, MojoFailureException - { - for ( File libDir : nuget.getLibraryDirectories() ) - { - File manifestInfoFile = new File( libDir, "manifestinfo.xml" ); - - if ( manifestInfoFile.exists() ) - { - if ( getLog().isDebugEnabled() ) - { - getLog().debug( - "NPANDAY-140-002: skipping; manifest info does already exist for " + libDir - ); - } - continue; - } - - if ( getLog().isDebugEnabled() ) - { - getLog().debug( - "NPANDAY-140-002: running manifestinfo for " + libDir - ); - } - - final NetExecutable executable; - try - { - - executable = netExecutableFactory.getExecutable( - getExecutableRequirement(), Lists.newArrayList( - libDir.getAbsolutePath(), "-x", "-r", "-q", "-o", manifestInfoFile.getAbsolutePath() - ), null - ); - - executable.execute(); - } - catch ( ExecutionException e ) - { - throw new MojoExecutionException( - "NPANDAY-140-000: Error occured when running manifestinfo for " + libDir, e - ); - } - catch ( PlatformUnsupportedException e ) - { - throw new MojoExecutionException( - "NPANDAY-140-001: Error occured when running manifestinfo for " + libDir, e - ); - } - } - } -} +/* + * 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 npanday.plugin.libraryimporter.resolve; + +import com.google.common.collect.Lists; +import npanday.PlatformUnsupportedException; +import npanday.executable.ExecutableRequirement; +import npanday.executable.ExecutionException; +import npanday.executable.NetExecutable; +import npanday.plugin.libraryimporter.model.NugetPackage; +import npanday.plugin.libraryimporter.skeletons.AbstractHandleEachImportMojo; +import npanday.plugin.libraryimporter.skeletons.AbstractLibraryImportsProvidingMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; + +import java.io.File; + +/** + * Generate manifest-info for each. + * + * @author <a href="mailto:lcornelius...@apache.org">Lars Corneliussen</a> + * @goal generate-package-manifestinfos + */ +public class GeneratePackageManifestInfosMojo + extends AbstractHandleEachImportMojo +{ + /** + * The executable identifier used to locate the right configurations from executable-plugins.xml. Can't be changed. + */ + private String executableIdentifier = "MANIFESTINFO"; + + /** + * The configured executable version, from executable-plugins.xml, to be used. Should align to a installed + * Azure SDK version. + * + * @parameter expression="${nuget.version}" default-value="1.0" + */ + private String executableVersion; + + /** + * The configured executable profile, from executable-plugins.xml, to be used. + * + * @parameter expression="${nuget.profile}" + */ + private String executableProfile; + + protected ExecutableRequirement getExecutableRequirement() + { + // TODO: profile is actually an identifier; the real profile has yet to be supported + return new ExecutableRequirement( getVendorRequirement(), executableIdentifier, executableVersion ); + } + + @Override + protected void handleNugetPackage( NugetPackage nuget ) throws MojoExecutionException, MojoFailureException + { + for ( File libDir : nuget.getLibraryDirectories() ) + { + File manifestInfoFile = new File( libDir, "manifestinfo.xml" ); + + if ( manifestInfoFile.exists() ) + { + if ( getLog().isDebugEnabled() ) + { + getLog().debug( + "NPANDAY-140-002: skipping; manifest info does already exist for " + libDir + ); + } + continue; + } + + if ( getLog().isDebugEnabled() ) + { + getLog().debug( + "NPANDAY-140-002: running manifestinfo for " + libDir + ); + } + + final NetExecutable executable; + try + { + + executable = netExecutableFactory.getExecutable( + getExecutableRequirement(), Lists.newArrayList( + libDir.getAbsolutePath(), "-x", "-r", "-q", "-o", manifestInfoFile.getAbsolutePath() + ), null + ); + + executable.execute(); + } + catch ( ExecutionException e ) + { + throw new MojoExecutionException( + "NPANDAY-140-000: Error occured when running manifestinfo for " + libDir, e + ); + } + catch ( PlatformUnsupportedException e ) + { + throw new MojoExecutionException( + "NPANDAY-140-001: Error occured when running manifestinfo for " + libDir, e + ); + } + } + } +} Propchange: incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/resolve/GeneratePackageManifestInfosMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/resolve/ResolvePackagesMojo.java URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/resolve/ResolvePackagesMojo.java?rev=1619666&r1=1619665&r2=1619666&view=diff ============================================================================== --- incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/resolve/ResolvePackagesMojo.java (original) +++ incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/resolve/ResolvePackagesMojo.java Fri Aug 22 05:17:20 2014 @@ -1,99 +1,99 @@ -/* - * 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 npanday.plugin.libraryimporter.resolve; - -import npanday.PlatformUnsupportedException; -import npanday.nuget.NugetException; -import npanday.nuget.NugetInstallParameters; -import npanday.plugin.libraryimporter.model.NugetPackage; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; - -import java.util.List; - -/** - * Resolve configured Nuget packages and install them to a cache directory. - * - * @author <a href="mailto:lcornelius...@apache.org">Lars Corneliussen</a> - * @goal resolve-packages - */ -public class ResolvePackagesMojo - extends AbstractNugetMojo -{ - @Override - protected void innerExecute() throws MojoExecutionException, MojoFailureException - { - super.innerExecute(); - - for ( NugetPackage nuget : getNugetImports() ) - { - if ( nuget.getDirectory().exists() ) - { - if ( getLog().isDebugEnabled() ) - { - getLog().debug( "NPANDAY-138-004: package " + nuget + " is already installed." ); - } - continue; - } - - NugetInstallParameters params = new NugetInstallParameters( nuget.getName() ); - params.setVersion( nuget.getVersion().toString() ); - params.setOutputDirectory( packageCacheDirectory ); - - // NOTE: since we only have explicit versions, it is ok, if they are pre-released - params.setPrerelease( true ); - - List<String> sources = nuget.getSources(); - if (sources != null){ - params.setSources( sources ); - if ( getLog().isDebugEnabled() ) - { - getLog().debug( "NPANDAY-138-005: package " + nuget + " has custom sources configured: " + sources ); - } - } - else { - if ( getLog().isDebugEnabled() ) - { - getLog().debug( "NPANDAY-138-006: package " + nuget + " will be retrieved from default sources" ); - } - } - - try - { - nugetInvoker.install( - getExecutableRequirement(), params - ); - } - catch ( PlatformUnsupportedException e ) - { - throw new MojoExecutionException( - "NPANDAY-138-002: An error occurred while trying to install package " + nuget, e - ); - } - catch ( NugetException e ) - { - throw new MojoExecutionException( - "NPANDAY-138-003: An error occurred while trying to install package " + nuget, e - ); - } - } - } -} - +/* + * 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 npanday.plugin.libraryimporter.resolve; + +import npanday.PlatformUnsupportedException; +import npanday.nuget.NugetException; +import npanday.nuget.NugetInstallParameters; +import npanday.plugin.libraryimporter.model.NugetPackage; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; + +import java.util.List; + +/** + * Resolve configured Nuget packages and install them to a cache directory. + * + * @author <a href="mailto:lcornelius...@apache.org">Lars Corneliussen</a> + * @goal resolve-packages + */ +public class ResolvePackagesMojo + extends AbstractNugetMojo +{ + @Override + protected void innerExecute() throws MojoExecutionException, MojoFailureException + { + super.innerExecute(); + + for ( NugetPackage nuget : getNugetImports() ) + { + if ( nuget.getDirectory().exists() ) + { + if ( getLog().isDebugEnabled() ) + { + getLog().debug( "NPANDAY-138-004: package " + nuget + " is already installed." ); + } + continue; + } + + NugetInstallParameters params = new NugetInstallParameters( nuget.getName() ); + params.setVersion( nuget.getVersion().toString() ); + params.setOutputDirectory( packageCacheDirectory ); + + // NOTE: since we only have explicit versions, it is ok, if they are pre-released + params.setPrerelease( true ); + + List<String> sources = nuget.getSources(); + if (sources != null){ + params.setSources( sources ); + if ( getLog().isDebugEnabled() ) + { + getLog().debug( "NPANDAY-138-005: package " + nuget + " has custom sources configured: " + sources ); + } + } + else { + if ( getLog().isDebugEnabled() ) + { + getLog().debug( "NPANDAY-138-006: package " + nuget + " will be retrieved from default sources" ); + } + } + + try + { + nugetInvoker.install( + getExecutableRequirement(), params + ); + } + catch ( PlatformUnsupportedException e ) + { + throw new MojoExecutionException( + "NPANDAY-138-002: An error occurred while trying to install package " + nuget, e + ); + } + catch ( NugetException e ) + { + throw new MojoExecutionException( + "NPANDAY-138-003: An error occurred while trying to install package " + nuget, e + ); + } + } + } +} + Propchange: incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/resolve/ResolvePackagesMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/skeletons/AbstractHandleEachImportMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/skeletons/AbstractHandleEachLibraryMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/skeletons/AbstractLibraryImportsProvidingMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/skeletons/AbstractNPandayMojo.java URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/skeletons/AbstractNPandayMojo.java?rev=1619666&r1=1619665&r2=1619666&view=diff ============================================================================== --- incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/skeletons/AbstractNPandayMojo.java (original) +++ incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/skeletons/AbstractNPandayMojo.java Fri Aug 22 05:17:20 2014 @@ -1,103 +1,103 @@ -/* - * 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 npanday.plugin.libraryimporter.skeletons; - -import com.google.common.base.Splitter; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.MavenProjectHelper; - -import static com.google.common.collect.Iterables.toArray; - -/** - * @author <a href="mailto:lcornelius...@apache.org">Lars Corneliussen</a> - */ -public abstract class AbstractNPandayMojo - extends AbstractMojo -{ - public Splitter SPLIT_ON_SEMICOLON = Splitter.on( ';' ).omitEmptyStrings().trimResults(); - - /** - * If the execution of this goal is to be skipped. - * - * @parameter - */ - protected boolean skip; - - /** - * The maven project. - * - * @parameter expression="${project}" - * @required - */ - protected MavenProject project; - - /** - * The maven project helper. - * - * @component - */ - protected MavenProjectHelper projectHelper; - - public final void execute() throws MojoExecutionException, MojoFailureException - { - if ( skip ) - { - getLog().info( - "NPANDAY-126-000: Execution of '" + getClass().getSimpleName() + "' was skipped by configuration." - ); - return; - } - - setupParameters(); - - innerExecute(); - } - - protected void setupParameters() - { - - } - - protected String[] firstNonNull( String commandlineValues, String[] configurationValues ) - { - return firstNonNull( commandlineValues, configurationValues, new String[0] ); - } - - protected String[] firstNonNull( String commandlineValues, String[] configurationValues, String[] defaultValue ) - { - if ( commandlineValues != null ) - { - return toArray( - SPLIT_ON_SEMICOLON.split( commandlineValues ), String.class - ); - } - - if (configurationValues != null){ - return configurationValues; - } - - return defaultValue; - } - - protected abstract void innerExecute() throws MojoExecutionException, MojoFailureException; -} +/* + * 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 npanday.plugin.libraryimporter.skeletons; + +import com.google.common.base.Splitter; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.MavenProjectHelper; + +import static com.google.common.collect.Iterables.toArray; + +/** + * @author <a href="mailto:lcornelius...@apache.org">Lars Corneliussen</a> + */ +public abstract class AbstractNPandayMojo + extends AbstractMojo +{ + public Splitter SPLIT_ON_SEMICOLON = Splitter.on( ';' ).omitEmptyStrings().trimResults(); + + /** + * If the execution of this goal is to be skipped. + * + * @parameter + */ + protected boolean skip; + + /** + * The maven project. + * + * @parameter expression="${project}" + * @required + */ + protected MavenProject project; + + /** + * The maven project helper. + * + * @component + */ + protected MavenProjectHelper projectHelper; + + public final void execute() throws MojoExecutionException, MojoFailureException + { + if ( skip ) + { + getLog().info( + "NPANDAY-126-000: Execution of '" + getClass().getSimpleName() + "' was skipped by configuration." + ); + return; + } + + setupParameters(); + + innerExecute(); + } + + protected void setupParameters() + { + + } + + protected String[] firstNonNull( String commandlineValues, String[] configurationValues ) + { + return firstNonNull( commandlineValues, configurationValues, new String[0] ); + } + + protected String[] firstNonNull( String commandlineValues, String[] configurationValues, String[] defaultValue ) + { + if ( commandlineValues != null ) + { + return toArray( + SPLIT_ON_SEMICOLON.split( commandlineValues ), String.class + ); + } + + if (configurationValues != null){ + return configurationValues; + } + + return defaultValue; + } + + protected abstract void innerExecute() throws MojoExecutionException, MojoFailureException; +} Propchange: incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/skeletons/AbstractNPandayMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/skeletons/AbstractNPandaySettingsAwareMojo.java URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/skeletons/AbstractNPandaySettingsAwareMojo.java?rev=1619666&r1=1619665&r2=1619666&view=diff ============================================================================== --- incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/skeletons/AbstractNPandaySettingsAwareMojo.java (original) +++ incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/skeletons/AbstractNPandaySettingsAwareMojo.java Fri Aug 22 05:17:20 2014 @@ -1,80 +1,80 @@ -/* - * 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 npanday.plugin.libraryimporter.skeletons; - -import npanday.registry.RepositoryRegistry; -import npanday.vendor.SettingsUtil; -import npanday.vendor.VendorRequirement; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; - -/** - * @author <a href="mailto:lcornelius...@apache.org">Lars Corneliussen</a> - */ -public abstract class AbstractNPandaySettingsAwareMojo - extends AbstractNPandayMojo -{ - - /** - * @parameter expression="${npanday.settings}" default-value="${user.home}/.m2" - */ - protected String settingsPath; - - /** - * The vendor of the framework, the executable is provided by or compatible with. - * - * @parameter expression="${vendor}" - */ - protected String vendor; - - /** - * The version of the framework vendor, the executable is provided by or compatible with. - * - * @parameter expression="${vendorVersion}" - */ - protected String vendorVersion; - - /** - * The framework version, the executable is compatible with. - * - * @parameter expression = "${frameworkVersion}" - */ - protected String frameworkVersion; - - /** - * @component - */ - protected RepositoryRegistry repositoryRegistry; - - /** - * @component - */ - protected npanday.executable.NetExecutableFactory netExecutableFactory; - - @Override - protected void innerExecute() throws MojoExecutionException, MojoFailureException - { - SettingsUtil.applyCustomSettings( getLog(), repositoryRegistry, settingsPath ); - } - - protected VendorRequirement getVendorRequirement(){ - return new VendorRequirement( vendor, vendorVersion, frameworkVersion); - } -} +/* + * 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 npanday.plugin.libraryimporter.skeletons; + +import npanday.registry.RepositoryRegistry; +import npanday.vendor.SettingsUtil; +import npanday.vendor.VendorRequirement; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; + +/** + * @author <a href="mailto:lcornelius...@apache.org">Lars Corneliussen</a> + */ +public abstract class AbstractNPandaySettingsAwareMojo + extends AbstractNPandayMojo +{ + + /** + * @parameter expression="${npanday.settings}" default-value="${user.home}/.m2" + */ + protected String settingsPath; + + /** + * The vendor of the framework, the executable is provided by or compatible with. + * + * @parameter expression="${vendor}" + */ + protected String vendor; + + /** + * The version of the framework vendor, the executable is provided by or compatible with. + * + * @parameter expression="${vendorVersion}" + */ + protected String vendorVersion; + + /** + * The framework version, the executable is compatible with. + * + * @parameter expression = "${frameworkVersion}" + */ + protected String frameworkVersion; + + /** + * @component + */ + protected RepositoryRegistry repositoryRegistry; + + /** + * @component + */ + protected npanday.executable.NetExecutableFactory netExecutableFactory; + + @Override + protected void innerExecute() throws MojoExecutionException, MojoFailureException + { + SettingsUtil.applyCustomSettings( getLog(), repositoryRegistry, settingsPath ); + } + + protected VendorRequirement getVendorRequirement(){ + return new VendorRequirement( vendor, vendorVersion, frameworkVersion); + } +} Propchange: incubator/npanday/trunk/plugins/library-importer-maven-plugin/src/main/java/npanday/plugin/libraryimporter/skeletons/AbstractNPandaySettingsAwareMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/CopyDependenciesMojo.java URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/CopyDependenciesMojo.java?rev=1619666&r1=1619665&r2=1619666&view=diff ============================================================================== --- incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/CopyDependenciesMojo.java (original) +++ incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/CopyDependenciesMojo.java Fri Aug 22 05:17:20 2014 @@ -1,245 +1,245 @@ -/* - * 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 npanday.plugin.resolver; - -import com.google.common.base.Strings; -import npanday.ArtifactType; -import npanday.LocalRepositoryUtil; -import npanday.PathUtil; -import npanday.registry.RepositoryRegistry; -import npanday.resolver.NPandayDependencyResolution; -import npanday.resolver.filter.DotnetSymbolsArtifactFilter; -import npanday.resolver.filter.DotnetExecutableArtifactFilter; -import npanday.resolver.filter.DotnetLibraryArtifactFilter; -import npanday.resolver.filter.OrArtifactFilter; -import npanday.vendor.SettingsUtil; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.artifact.resolver.filter.AndArtifactFilter; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.artifact.resolver.filter.InversionArtifactFilter; -import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.util.FileUtils; - -import java.io.File; -import java.io.IOException; -import java.util.List; -import java.util.Set; - -/** - * Resolves and copies .NET assemblies. - * - * @author <a href="m...@lcorneliussen.de">Lars Corneliussen, Faktum Software</a> - * @goal copy-dependencies - */ -public class CopyDependenciesMojo - extends AbstractMojo -{ - /** - * @parameter expression="${npanday.settings}" default-value="${user.home}/.m2" - */ - private String settingsPath; - - /** - * @component - */ - private RepositoryRegistry repositoryRegistry; - - /** - * The maven project. - * - * @parameter expression="${project}" - * @required - */ - private MavenProject project; - - /** - * The local Maven repository. - * - * @parameter expression="${settings.localRepository}" - */ - private File localRepository; - - /** - * @parameter default-value="compile" expression="${includeScope}" - */ - private String includeScope; - - /** - * @parameter expression="${excludeScope}" - */ - private String excludeScope; - - /** - * Specifies, if pdbs should be copied, too. - * - * @parameter default-value="true" expression="${includePdbs}" - */ - private Boolean includePdbs; - - /** - * @component - */ - private NPandayDependencyResolution dependencyResolution; - - /** - * @parameter default-value="${project.build.directory}\.references" - */ - private File outputDirectory; - - /** - * @parameter default-value="false" - */ - private boolean skip; - - /** - * The reactor projects. - * - * @parameter expression="${reactorProjects}" - */ - protected List<MavenProject> reactorProjects; - - /** - * If specified, Artifacts that are part of the same reactor will not be copied. - * Transitive dependencies of these artifacts will still get copied, though. - * - * @parameter default-value="false" - */ - private boolean skipReactorArtifacts; - - public void execute() throws MojoExecutionException, MojoFailureException - { - String skipReason = ""; - if ( !skip ) - { - ArtifactType knownType = ArtifactType.getArtifactTypeForPackagingName( - project.getPackaging() - ); - - if ( knownType.equals( ArtifactType.NULL )) - { - skip = true; - skipReason = - ", because the current project (type:" + project.getPackaging() + ") is not built with NPanday"; - } - } - - if ( skip ) - { - getLog().info( "NPANDAY-158-001: Mojo for copying dependencies was intentionally skipped" + skipReason ); - return; - } - - SettingsUtil.applyCustomSettings( getLog(), repositoryRegistry, settingsPath ); - - AndArtifactFilter includeFilter = new AndArtifactFilter(); - - OrArtifactFilter typeIncludes = new OrArtifactFilter(); - typeIncludes.add( new DotnetExecutableArtifactFilter() ); - typeIncludes.add( new DotnetLibraryArtifactFilter() ); - - if (includePdbs){ - typeIncludes.add( new DotnetSymbolsArtifactFilter() ); - } - - includeFilter.add( typeIncludes ); - - if ( !Strings.isNullOrEmpty( includeScope ) ) - { - includeFilter.add( new ScopeArtifactFilter( includeScope ) ); - } - - Set<Artifact> artifacts; - try - { - artifacts = dependencyResolution.require( - project, LocalRepositoryUtil.create( localRepository ), includeFilter - ); - } - catch ( ArtifactResolutionException e ) - { - throw new MojoExecutionException( - "NPANDAY-158-003: dependency resolution for scope " + includeScope + " failed!", e - ); - } - - /** - * Should be resolved, but then not copied - */ - if ( !Strings.isNullOrEmpty( excludeScope ) ) - { - includeFilter.add( new InversionArtifactFilter( new ScopeArtifactFilter( excludeScope ) ) ); - } - - if ( skipReactorArtifacts ){ - getLog().info( "NPANDAY-158-008: " + reactorProjects ); - - includeFilter.add( new InversionArtifactFilter( new ArtifactFilter() - { - public boolean include( Artifact artifact ) - { - for (MavenProject project : reactorProjects){ - // we don't care about the type and the classifier here - if (project.getGroupId().equals(artifact.getGroupId()) - && project.getArtifactId().equals(artifact.getArtifactId()) - && project.getVersion().equals(artifact.getVersion())){ - return true; - } - } - return false; - } - } )); - } - - for ( Artifact dependency : artifacts ) - { - if ( !includeFilter.include( dependency ) ) - { - getLog().debug( "NPANDAY-158-006: dependency " + dependency + " was excluded" ); - - continue; - } - - try - { - File targetFile = new File( outputDirectory, PathUtil.getPlainArtifactFileName( dependency ) ); - if ( !targetFile.exists() - || targetFile.lastModified() != dependency.getFile().lastModified() - || targetFile.length() != dependency.getFile().length() ) - { - getLog().info( "NPANDAY-158-004: copy " + dependency.getFile() + " to " + targetFile ); - FileUtils.copyFile( dependency.getFile(), targetFile ); - } - else{ - getLog().debug( "NPANDAY-158-007: dependency " + dependency + " is yet up to date" ); - } - } - catch ( IOException ioe ) - { - throw new MojoExecutionException( "NPANDAY-158-005: Error copying dependency " + dependency, ioe ); - } - } - } - -} +/* + * 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 npanday.plugin.resolver; + +import com.google.common.base.Strings; +import npanday.ArtifactType; +import npanday.LocalRepositoryUtil; +import npanday.PathUtil; +import npanday.registry.RepositoryRegistry; +import npanday.resolver.NPandayDependencyResolution; +import npanday.resolver.filter.DotnetSymbolsArtifactFilter; +import npanday.resolver.filter.DotnetExecutableArtifactFilter; +import npanday.resolver.filter.DotnetLibraryArtifactFilter; +import npanday.resolver.filter.OrArtifactFilter; +import npanday.vendor.SettingsUtil; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.resolver.ArtifactResolutionException; +import org.apache.maven.artifact.resolver.filter.AndArtifactFilter; +import org.apache.maven.artifact.resolver.filter.ArtifactFilter; +import org.apache.maven.artifact.resolver.filter.InversionArtifactFilter; +import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.util.FileUtils; + +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Set; + +/** + * Resolves and copies .NET assemblies. + * + * @author <a href="m...@lcorneliussen.de">Lars Corneliussen, Faktum Software</a> + * @goal copy-dependencies + */ +public class CopyDependenciesMojo + extends AbstractMojo +{ + /** + * @parameter expression="${npanday.settings}" default-value="${user.home}/.m2" + */ + private String settingsPath; + + /** + * @component + */ + private RepositoryRegistry repositoryRegistry; + + /** + * The maven project. + * + * @parameter expression="${project}" + * @required + */ + private MavenProject project; + + /** + * The local Maven repository. + * + * @parameter expression="${settings.localRepository}" + */ + private File localRepository; + + /** + * @parameter default-value="compile" expression="${includeScope}" + */ + private String includeScope; + + /** + * @parameter expression="${excludeScope}" + */ + private String excludeScope; + + /** + * Specifies, if pdbs should be copied, too. + * + * @parameter default-value="true" expression="${includePdbs}" + */ + private Boolean includePdbs; + + /** + * @component + */ + private NPandayDependencyResolution dependencyResolution; + + /** + * @parameter default-value="${project.build.directory}\.references" + */ + private File outputDirectory; + + /** + * @parameter default-value="false" + */ + private boolean skip; + + /** + * The reactor projects. + * + * @parameter expression="${reactorProjects}" + */ + protected List<MavenProject> reactorProjects; + + /** + * If specified, Artifacts that are part of the same reactor will not be copied. + * Transitive dependencies of these artifacts will still get copied, though. + * + * @parameter default-value="false" + */ + private boolean skipReactorArtifacts; + + public void execute() throws MojoExecutionException, MojoFailureException + { + String skipReason = ""; + if ( !skip ) + { + ArtifactType knownType = ArtifactType.getArtifactTypeForPackagingName( + project.getPackaging() + ); + + if ( knownType.equals( ArtifactType.NULL )) + { + skip = true; + skipReason = + ", because the current project (type:" + project.getPackaging() + ") is not built with NPanday"; + } + } + + if ( skip ) + { + getLog().info( "NPANDAY-158-001: Mojo for copying dependencies was intentionally skipped" + skipReason ); + return; + } + + SettingsUtil.applyCustomSettings( getLog(), repositoryRegistry, settingsPath ); + + AndArtifactFilter includeFilter = new AndArtifactFilter(); + + OrArtifactFilter typeIncludes = new OrArtifactFilter(); + typeIncludes.add( new DotnetExecutableArtifactFilter() ); + typeIncludes.add( new DotnetLibraryArtifactFilter() ); + + if (includePdbs){ + typeIncludes.add( new DotnetSymbolsArtifactFilter() ); + } + + includeFilter.add( typeIncludes ); + + if ( !Strings.isNullOrEmpty( includeScope ) ) + { + includeFilter.add( new ScopeArtifactFilter( includeScope ) ); + } + + Set<Artifact> artifacts; + try + { + artifacts = dependencyResolution.require( + project, LocalRepositoryUtil.create( localRepository ), includeFilter + ); + } + catch ( ArtifactResolutionException e ) + { + throw new MojoExecutionException( + "NPANDAY-158-003: dependency resolution for scope " + includeScope + " failed!", e + ); + } + + /** + * Should be resolved, but then not copied + */ + if ( !Strings.isNullOrEmpty( excludeScope ) ) + { + includeFilter.add( new InversionArtifactFilter( new ScopeArtifactFilter( excludeScope ) ) ); + } + + if ( skipReactorArtifacts ){ + getLog().info( "NPANDAY-158-008: " + reactorProjects ); + + includeFilter.add( new InversionArtifactFilter( new ArtifactFilter() + { + public boolean include( Artifact artifact ) + { + for (MavenProject project : reactorProjects){ + // we don't care about the type and the classifier here + if (project.getGroupId().equals(artifact.getGroupId()) + && project.getArtifactId().equals(artifact.getArtifactId()) + && project.getVersion().equals(artifact.getVersion())){ + return true; + } + } + return false; + } + } )); + } + + for ( Artifact dependency : artifacts ) + { + if ( !includeFilter.include( dependency ) ) + { + getLog().debug( "NPANDAY-158-006: dependency " + dependency + " was excluded" ); + + continue; + } + + try + { + File targetFile = new File( outputDirectory, PathUtil.getPlainArtifactFileName( dependency ) ); + if ( !targetFile.exists() + || targetFile.lastModified() != dependency.getFile().lastModified() + || targetFile.length() != dependency.getFile().length() ) + { + getLog().info( "NPANDAY-158-004: copy " + dependency.getFile() + " to " + targetFile ); + FileUtils.copyFile( dependency.getFile(), targetFile ); + } + else{ + getLog().debug( "NPANDAY-158-007: dependency " + dependency + " is yet up to date" ); + } + } + catch ( IOException ioe ) + { + throw new MojoExecutionException( "NPANDAY-158-005: Error copying dependency " + dependency, ioe ); + } + } + } + +} Propchange: incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/CopyDependenciesMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/ListDependenciesMojo.java URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/ListDependenciesMojo.java?rev=1619666&r1=1619665&r2=1619666&view=diff ============================================================================== --- incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/ListDependenciesMojo.java (original) +++ incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/ListDependenciesMojo.java Fri Aug 22 05:17:20 2014 @@ -1,197 +1,197 @@ -/* - * 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 npanday.plugin.resolver; - -import com.google.common.base.Strings; -import npanday.LocalRepositoryUtil; -import npanday.registry.RepositoryRegistry; -import npanday.resolver.NPandayDependencyResolution; -import npanday.vendor.SettingsUtil; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.artifact.resolver.filter.AndArtifactFilter; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.artifact.resolver.filter.InversionArtifactFilter; -import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.project.MavenProject; - -import java.io.File; -import java.util.List; -import java.util.Set; - -/** - * Resolves and copies .NET assemblies. - * - * @author <a href="m...@lcorneliussen.de">Lars Corneliussen, Faktum Software</a> - * @goal list-dependencies - */ -public class ListDependenciesMojo - extends AbstractMojo -{ - /** - * @parameter expression="${npanday.settings}" default-value="${user.home}/.m2" - */ - private String settingsPath; - - /** - * @component - */ - private RepositoryRegistry repositoryRegistry; - - /** - * The maven project. - * - * @parameter expression="${project}" - * @required - */ - private MavenProject project; - - /** - * The local Maven repository. - * - * @parameter expression="${settings.localRepository}" - */ - private File localRepository; - - /** - * @parameter default-value="compile" expression="${includeScope}" - */ - private String includeScope; - - /** - * @parameter expression="${excludeScope}" - */ - private String excludeScope; - - /** - * @component - */ - private NPandayDependencyResolution dependencyResolution; - - /** - * @parameter default-value="${project.build.directory}\.references" - */ - private File outputDirectory; - - /** - * @parameter default-value="false" - */ - private boolean skip; - - /** - * The reactor projects. - * - * @parameter expression="${reactorProjects}" - */ - protected List<MavenProject> reactorProjects; - - /** - * If specified, Artifacts that are part of the same reactor will not be copied. - * Transitive dependencies of these artifacts will still get copied, though. - * - * @parameter default-value="false" - */ - private boolean skipReactorArtifacts; - - public void execute() throws MojoExecutionException, MojoFailureException - { - String skipReason = ""; - if ( skip ) - { - getLog().info( "NPANDAY-161-001: Mojo for listing dependencies was intentionally skipped" + skipReason ); - return; - } - - SettingsUtil.applyCustomSettings( getLog(), repositoryRegistry, settingsPath ); - - AndArtifactFilter includeFilter = new AndArtifactFilter(); - - if ( !Strings.isNullOrEmpty( includeScope ) ) - { - includeFilter.add( new ScopeArtifactFilter( includeScope ) ); - } - - Set<Artifact> artifacts; - try - { - // TODO: Workarround. Somehow in the first run, PDBs wont be part of the result! - dependencyResolution.require( - project, LocalRepositoryUtil.create( localRepository ), includeFilter - ); - artifacts = dependencyResolution.require( - project, LocalRepositoryUtil.create( localRepository ), includeFilter - ); - } - catch ( ArtifactResolutionException e ) - { - throw new MojoExecutionException( - "NPANDAY-161-003: dependency resolution for scope " + includeScope + " failed!", e - ); - } - - /** - * Should be resolved, but then not shown - */ - if ( !Strings.isNullOrEmpty( excludeScope ) ) - { - includeFilter.add( new InversionArtifactFilter( new ScopeArtifactFilter( excludeScope ) ) ); - } - - if ( skipReactorArtifacts ){ - getLog().info( "NPANDAY-161-008: " + reactorProjects ); - - includeFilter.add( new InversionArtifactFilter( new ArtifactFilter() - { - public boolean include( Artifact artifact ) - { - for (MavenProject project : reactorProjects){ - // we don't care about the type and the classifier here - if (project.getGroupId().equals(artifact.getGroupId()) - && project.getArtifactId().equals(artifact.getArtifactId()) - && project.getVersion().equals(artifact.getVersion())){ - return true; - } - } - return false; - } - } )); - } - - getLog().info( - "The following files have been resolved:" - ); - for ( Artifact dependency : artifacts ) - { - if ( !includeFilter.include( dependency ) ) - { - getLog().debug( "NPANDAY-161-006: dependency " + dependency + " was excluded" ); - continue; - } - - getLog().info( - " " + dependency.getId() + ":" + dependency.getScope() + " -> " + dependency.getFile() - ); - } - } - -} +/* + * 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 npanday.plugin.resolver; + +import com.google.common.base.Strings; +import npanday.LocalRepositoryUtil; +import npanday.registry.RepositoryRegistry; +import npanday.resolver.NPandayDependencyResolution; +import npanday.vendor.SettingsUtil; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.resolver.ArtifactResolutionException; +import org.apache.maven.artifact.resolver.filter.AndArtifactFilter; +import org.apache.maven.artifact.resolver.filter.ArtifactFilter; +import org.apache.maven.artifact.resolver.filter.InversionArtifactFilter; +import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; + +import java.io.File; +import java.util.List; +import java.util.Set; + +/** + * Resolves and copies .NET assemblies. + * + * @author <a href="m...@lcorneliussen.de">Lars Corneliussen, Faktum Software</a> + * @goal list-dependencies + */ +public class ListDependenciesMojo + extends AbstractMojo +{ + /** + * @parameter expression="${npanday.settings}" default-value="${user.home}/.m2" + */ + private String settingsPath; + + /** + * @component + */ + private RepositoryRegistry repositoryRegistry; + + /** + * The maven project. + * + * @parameter expression="${project}" + * @required + */ + private MavenProject project; + + /** + * The local Maven repository. + * + * @parameter expression="${settings.localRepository}" + */ + private File localRepository; + + /** + * @parameter default-value="compile" expression="${includeScope}" + */ + private String includeScope; + + /** + * @parameter expression="${excludeScope}" + */ + private String excludeScope; + + /** + * @component + */ + private NPandayDependencyResolution dependencyResolution; + + /** + * @parameter default-value="${project.build.directory}\.references" + */ + private File outputDirectory; + + /** + * @parameter default-value="false" + */ + private boolean skip; + + /** + * The reactor projects. + * + * @parameter expression="${reactorProjects}" + */ + protected List<MavenProject> reactorProjects; + + /** + * If specified, Artifacts that are part of the same reactor will not be copied. + * Transitive dependencies of these artifacts will still get copied, though. + * + * @parameter default-value="false" + */ + private boolean skipReactorArtifacts; + + public void execute() throws MojoExecutionException, MojoFailureException + { + String skipReason = ""; + if ( skip ) + { + getLog().info( "NPANDAY-161-001: Mojo for listing dependencies was intentionally skipped" + skipReason ); + return; + } + + SettingsUtil.applyCustomSettings( getLog(), repositoryRegistry, settingsPath ); + + AndArtifactFilter includeFilter = new AndArtifactFilter(); + + if ( !Strings.isNullOrEmpty( includeScope ) ) + { + includeFilter.add( new ScopeArtifactFilter( includeScope ) ); + } + + Set<Artifact> artifacts; + try + { + // TODO: Workarround. Somehow in the first run, PDBs wont be part of the result! + dependencyResolution.require( + project, LocalRepositoryUtil.create( localRepository ), includeFilter + ); + artifacts = dependencyResolution.require( + project, LocalRepositoryUtil.create( localRepository ), includeFilter + ); + } + catch ( ArtifactResolutionException e ) + { + throw new MojoExecutionException( + "NPANDAY-161-003: dependency resolution for scope " + includeScope + " failed!", e + ); + } + + /** + * Should be resolved, but then not shown + */ + if ( !Strings.isNullOrEmpty( excludeScope ) ) + { + includeFilter.add( new InversionArtifactFilter( new ScopeArtifactFilter( excludeScope ) ) ); + } + + if ( skipReactorArtifacts ){ + getLog().info( "NPANDAY-161-008: " + reactorProjects ); + + includeFilter.add( new InversionArtifactFilter( new ArtifactFilter() + { + public boolean include( Artifact artifact ) + { + for (MavenProject project : reactorProjects){ + // we don't care about the type and the classifier here + if (project.getGroupId().equals(artifact.getGroupId()) + && project.getArtifactId().equals(artifact.getArtifactId()) + && project.getVersion().equals(artifact.getVersion())){ + return true; + } + } + return false; + } + } )); + } + + getLog().info( + "The following files have been resolved:" + ); + for ( Artifact dependency : artifacts ) + { + if ( !includeFilter.include( dependency ) ) + { + getLog().debug( "NPANDAY-161-006: dependency " + dependency + " was excluded" ); + continue; + } + + getLog().info( + " " + dependency.getId() + ":" + dependency.getScope() + " -> " + dependency.getFile() + ); + } + } + +} Propchange: incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/ListDependenciesMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/AbstractTestrelatedMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday/plugin/msdeploy/create/AbstractCreatePackageMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday/plugin/msdeploy/create/CreateIisAppPackageMojo.java URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday/plugin/msdeploy/create/CreateIisAppPackageMojo.java?rev=1619666&r1=1619665&r2=1619666&view=diff ============================================================================== --- incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday/plugin/msdeploy/create/CreateIisAppPackageMojo.java (original) +++ incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday/plugin/msdeploy/create/CreateIisAppPackageMojo.java Fri Aug 22 05:17:20 2014 @@ -1,47 +1,47 @@ -/* - * 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 npanday.plugin.msdeploy.create; - -import java.util.List; - -/** - * Picks up a prepared package folder and packages it using the MSDeploy command line tool - * and the <a href="http://technet.microsoft.com/en-us/library/dd569054(v=ws.10).aspx">Web Deploy iisApp Provider</a> - * - * @author <a href="mailto:lcornelius...@apache.org">Lars Corneliussen</a> - * @phase package - * @goal create-iisApp-package - */ -public class CreateIisAppPackageMojo - extends AbstractCreatePackageMojo -{ - @Override - protected List<Package> prepareIterationItems() - { - List<Package> packages = super.prepareIterationItems(); - - for ( Package pkg : packages ) - { - pkg.setSourceProvider( "iisApp" ); - } - - return packages; - } -} +/* + * 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 npanday.plugin.msdeploy.create; + +import java.util.List; + +/** + * Picks up a prepared package folder and packages it using the MSDeploy command line tool + * and the <a href="http://technet.microsoft.com/en-us/library/dd569054(v=ws.10).aspx">Web Deploy iisApp Provider</a> + * + * @author <a href="mailto:lcornelius...@apache.org">Lars Corneliussen</a> + * @phase package + * @goal create-iisApp-package + */ +public class CreateIisAppPackageMojo + extends AbstractCreatePackageMojo +{ + @Override + protected List<Package> prepareIterationItems() + { + List<Package> packages = super.prepareIterationItems(); + + for ( Package pkg : packages ) + { + pkg.setSourceProvider( "iisApp" ); + } + + return packages; + } +} Propchange: incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday/plugin/msdeploy/create/CreateIisAppPackageMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday/plugin/msdeploy/sync/Destination.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday/plugin/msdeploy/sync/SyncEvent.java ------------------------------------------------------------------------------ svn:eol-style = native