Fixed line feeds, added .gitattributes

This commit is contained in:
Kristian Rosenvold 2013-01-29 16:26:35 +01:00
parent 2f97f96fb1
commit 176a85f43c
9 changed files with 492 additions and 486 deletions

10
.gitattributes vendored
View File

@ -1,2 +1,8 @@
*.jar -text -crlf
*.graffle -text -crlf
# Auto detect text files and perform LF normalization
* text=auto
*.java text diff=java
*.html text diff=html
*.css text
*.js text
*.sql text

View File

@ -1,76 +1,76 @@
package org.apache.maven.repository.internal;
/*
* 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.net.MalformedURLException;
import org.apache.maven.repository.internal.util.ConsoleRepositoryListener;
import org.apache.maven.repository.internal.util.ConsoleTransferListener;
import org.codehaus.plexus.PlexusTestCase;
import org.sonatype.aether.RepositorySystem;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.repository.LocalRepository;
import org.sonatype.aether.repository.RemoteRepository;
public abstract class AbstractRepositoryTestCase
extends PlexusTestCase
{
protected RepositorySystem system;
protected RepositorySystemSession session;
@Override
protected void setUp()
throws Exception
{
super.setUp();
system = lookup( RepositorySystem.class );
session = newMavenRepositorySystemSession( system );
}
@Override
protected void tearDown()
throws Exception
{
session = null;
system = null;
super.tearDown();
}
public static RepositorySystemSession newMavenRepositorySystemSession( RepositorySystem system )
{
MavenRepositorySystemSession session = new MavenRepositorySystemSession( true );
LocalRepository localRepo = new LocalRepository( "target/local-repo" );
session.setLocalRepositoryManager( system.newLocalRepositoryManager( localRepo ) );
session.setTransferListener( new ConsoleTransferListener() );
session.setRepositoryListener( new ConsoleRepositoryListener() );
return session;
}
public static RemoteRepository newTestRepository()
throws MalformedURLException
{
return new RemoteRepository( "repo", "default",
getTestFile( "target/test-classes/repo" ).toURI().toURL().toString() );
}
}
package org.apache.maven.repository.internal;
/*
* 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.net.MalformedURLException;
import org.apache.maven.repository.internal.util.ConsoleRepositoryListener;
import org.apache.maven.repository.internal.util.ConsoleTransferListener;
import org.codehaus.plexus.PlexusTestCase;
import org.sonatype.aether.RepositorySystem;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.repository.LocalRepository;
import org.sonatype.aether.repository.RemoteRepository;
public abstract class AbstractRepositoryTestCase
extends PlexusTestCase
{
protected RepositorySystem system;
protected RepositorySystemSession session;
@Override
protected void setUp()
throws Exception
{
super.setUp();
system = lookup( RepositorySystem.class );
session = newMavenRepositorySystemSession( system );
}
@Override
protected void tearDown()
throws Exception
{
session = null;
system = null;
super.tearDown();
}
public static RepositorySystemSession newMavenRepositorySystemSession( RepositorySystem system )
{
MavenRepositorySystemSession session = new MavenRepositorySystemSession( true );
LocalRepository localRepo = new LocalRepository( "target/local-repo" );
session.setLocalRepositoryManager( system.newLocalRepositoryManager( localRepo ) );
session.setTransferListener( new ConsoleTransferListener() );
session.setRepositoryListener( new ConsoleRepositoryListener() );
return session;
}
public static RemoteRepository newTestRepository()
throws MalformedURLException
{
return new RemoteRepository( "repo", "default",
getTestFile( "target/test-classes/repo" ).toURI().toURL().toString() );
}
}

View File

@ -1,96 +1,96 @@
package org.apache.maven.repository.internal;
/*
* 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.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.impl.VersionResolver;
import org.sonatype.aether.resolution.VersionRequest;
import org.sonatype.aether.resolution.VersionResult;
import org.sonatype.aether.util.artifact.DefaultArtifact;
public class DefaultVersionResolverTest
extends AbstractRepositoryTestCase
{
private DefaultVersionResolver versionResolver;
@Override
protected void setUp()
throws Exception
{
super.setUp();
// be sure we're testing the right class, i.e. DefaultVersionResolver.class
versionResolver = (DefaultVersionResolver) lookup( VersionResolver.class, "default" );
}
@Override
protected void tearDown()
throws Exception
{
versionResolver = null;
super.tearDown();
}
public void testResolveSeparateInstalledClassifiedNonUniqueVersionedArtifacts()
throws Exception
{
VersionRequest requestB = new VersionRequest();
requestB.addRepository( newTestRepository() );
Artifact artifactB =
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierB", "jar", "07.20.3-SNAPSHOT" );
requestB.setArtifact( artifactB );
VersionResult resultB = versionResolver.resolveVersion( session, requestB );
assertEquals( "07.20.3-20120809.112920-97", resultB.getVersion() );
VersionRequest requestA = new VersionRequest();
requestA.addRepository( newTestRepository() );
Artifact artifactA =
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierA", "jar", "07.20.3-SNAPSHOT" );
requestA.setArtifact( artifactA );
VersionResult resultA = versionResolver.resolveVersion( session, requestA );
assertEquals( "07.20.3-20120809.112124-88", resultA.getVersion() );
}
public void testResolveSeparateInstalledClassifiedNonVersionedArtifacts()
throws Exception
{
VersionRequest requestA = new VersionRequest();
requestA.addRepository( newTestRepository() );
String versionA = "07.20.3-20120809.112124-88";
Artifact artifactA =
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierA", "jar", versionA );
requestA.setArtifact( artifactA );
VersionResult resultA = versionResolver.resolveVersion( session, requestA );
assertEquals( versionA, resultA.getVersion() );
VersionRequest requestB = new VersionRequest();
requestB.addRepository( newTestRepository() );
String versionB = "07.20.3-20120809.112920-97";
Artifact artifactB =
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierB", "jar", versionB );
requestB.setArtifact( artifactB );
VersionResult resultB = versionResolver.resolveVersion( session, requestB );
assertEquals( versionB, resultB.getVersion() );
}
}
package org.apache.maven.repository.internal;
/*
* 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.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.impl.VersionResolver;
import org.sonatype.aether.resolution.VersionRequest;
import org.sonatype.aether.resolution.VersionResult;
import org.sonatype.aether.util.artifact.DefaultArtifact;
public class DefaultVersionResolverTest
extends AbstractRepositoryTestCase
{
private DefaultVersionResolver versionResolver;
@Override
protected void setUp()
throws Exception
{
super.setUp();
// be sure we're testing the right class, i.e. DefaultVersionResolver.class
versionResolver = (DefaultVersionResolver) lookup( VersionResolver.class, "default" );
}
@Override
protected void tearDown()
throws Exception
{
versionResolver = null;
super.tearDown();
}
public void testResolveSeparateInstalledClassifiedNonUniqueVersionedArtifacts()
throws Exception
{
VersionRequest requestB = new VersionRequest();
requestB.addRepository( newTestRepository() );
Artifact artifactB =
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierB", "jar", "07.20.3-SNAPSHOT" );
requestB.setArtifact( artifactB );
VersionResult resultB = versionResolver.resolveVersion( session, requestB );
assertEquals( "07.20.3-20120809.112920-97", resultB.getVersion() );
VersionRequest requestA = new VersionRequest();
requestA.addRepository( newTestRepository() );
Artifact artifactA =
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierA", "jar", "07.20.3-SNAPSHOT" );
requestA.setArtifact( artifactA );
VersionResult resultA = versionResolver.resolveVersion( session, requestA );
assertEquals( "07.20.3-20120809.112124-88", resultA.getVersion() );
}
public void testResolveSeparateInstalledClassifiedNonVersionedArtifacts()
throws Exception
{
VersionRequest requestA = new VersionRequest();
requestA.addRepository( newTestRepository() );
String versionA = "07.20.3-20120809.112124-88";
Artifact artifactA =
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierA", "jar", versionA );
requestA.setArtifact( artifactA );
VersionResult resultA = versionResolver.resolveVersion( session, requestA );
assertEquals( versionA, resultA.getVersion() );
VersionRequest requestB = new VersionRequest();
requestB.addRepository( newTestRepository() );
String versionB = "07.20.3-20120809.112920-97";
Artifact artifactB =
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierB", "jar", versionB );
requestB.setArtifact( artifactB );
VersionResult resultB = versionResolver.resolveVersion( session, requestB );
assertEquals( versionB, resultB.getVersion() );
}
}

View File

@ -1,49 +1,49 @@
<?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.
-->
<metadata xmlns="http://maven.apache.org/METADATA/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/METADATA/1.1.0 http://maven.apache.org/xsd/metadata-1.1.0.xsd"
modelVersion="1.1.0">
<groupId>org.apache.maven.its</groupId>
<artifactId>dep-mng5324</artifactId>
<version>07.20.3-SNAPSHOT</version><!-- metadata for artifact snapshot -->
<versioning>
<snapshot>
<timestamp>20120809.112920</timestamp>
<buildNumber>97</buildNumber>
</snapshot>
<lastUpdated>20120809112920</lastUpdated>
<snapshotVersions>
<snapshotVersion>
<classifier>classifierA</classifier>
<extension>jar</extension>
<value>07.20.3-20120809.112124-88</value>
<updated>20120809112124</updated>
</snapshotVersion>
<snapshotVersion>
<classifier>classifierB</classifier>
<extension>jar</extension>
<value>07.20.3-20120809.112920-97</value>
<updated>20120809112920</updated>
</snapshotVersion>
</snapshotVersions>
</versioning>
<?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.
-->
<metadata xmlns="http://maven.apache.org/METADATA/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/METADATA/1.1.0 http://maven.apache.org/xsd/metadata-1.1.0.xsd"
modelVersion="1.1.0">
<groupId>org.apache.maven.its</groupId>
<artifactId>dep-mng5324</artifactId>
<version>07.20.3-SNAPSHOT</version><!-- metadata for artifact snapshot -->
<versioning>
<snapshot>
<timestamp>20120809.112920</timestamp>
<buildNumber>97</buildNumber>
</snapshot>
<lastUpdated>20120809112920</lastUpdated>
<snapshotVersions>
<snapshotVersion>
<classifier>classifierA</classifier>
<extension>jar</extension>
<value>07.20.3-20120809.112124-88</value>
<updated>20120809112124</updated>
</snapshotVersion>
<snapshotVersion>
<classifier>classifierB</classifier>
<extension>jar</extension>
<value>07.20.3-20120809.112920-97</value>
<updated>20120809112920</updated>
</snapshotVersion>
</snapshotVersions>
</versioning>
</metadata>

View File

@ -1,41 +1,41 @@
---
Default Artifact Handlers Reference
---
Hervé Boutemy
---
2012-08-13
---
Default Artifact Handlers Reference
Some artifact handlers are defined by default:
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|| type || extension || packaging || classifier || language || added to classpath || includesDependencies ||
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<pom>>> | <= type> | <= type> | | none | | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<jar>>> | <= type> | <= type> | | java | <<<true>>> | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<maven-plugin>>> | <<<jar>>> | <= type> | | java | <<<true>>> | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<ejb>>> | <<<jar>>> | <= type> | | java | <<<true>>> | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<ejb3>>> | <= type> | <= type> | | java | | <<<true>>> |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<war>>> | <= type> | <= type> | | java | | <<<true>>> |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<ear>>> | <= type> | <= type> | | java | | <<<true>>> |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<rar>>> | <= type> | <= type> | | java | | <<<true>>> |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<par>>> | <= type> | <= type> | | java | | <<<true>>> |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<java-source>>> | <<<jar>>> | <= type> | <<<sources>>> | java | | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<javadoc>>> | <<<jar>>> | <= type> | <<<javadoc>>> | java | <<<true>>> | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<ejb-client>>> | <<<jar>>> | <<<ejb>>> | <<<client>>> | java | <<<true>>> | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<test-jar>>> | <<<jar>>> | <<<jar>>> | <<<tests>>> | java | <<<true>>> | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
---
Default Artifact Handlers Reference
---
Hervé Boutemy
---
2012-08-13
---
Default Artifact Handlers Reference
Some artifact handlers are defined by default:
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|| type || extension || packaging || classifier || language || added to classpath || includesDependencies ||
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<pom>>> | <= type> | <= type> | | none | | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<jar>>> | <= type> | <= type> | | java | <<<true>>> | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<maven-plugin>>> | <<<jar>>> | <= type> | | java | <<<true>>> | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<ejb>>> | <<<jar>>> | <= type> | | java | <<<true>>> | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<ejb3>>> | <= type> | <= type> | | java | | <<<true>>> |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<war>>> | <= type> | <= type> | | java | | <<<true>>> |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<ear>>> | <= type> | <= type> | | java | | <<<true>>> |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<rar>>> | <= type> | <= type> | | java | | <<<true>>> |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<par>>> | <= type> | <= type> | | java | | <<<true>>> |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<java-source>>> | <<<jar>>> | <= type> | <<<sources>>> | java | | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<javadoc>>> | <<<jar>>> | <= type> | <<<javadoc>>> | java | <<<true>>> | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<ejb-client>>> | <<<jar>>> | <<<ejb>>> | <<<client>>> | java | <<<true>>> | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<test-jar>>> | <<<jar>>> | <<<jar>>> | <<<tests>>> | java | <<<true>>> | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+

View File

@ -1,89 +1,89 @@
package org.apache.maven.artifact.handler;
/*
* 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.List;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
public class ArtifactHandlerTest
extends PlexusTestCase
{
public void testAptConsistency()
throws Exception
{
File apt = getTestFile( "src/site/apt/artifact-handlers.apt" );
@SuppressWarnings( "unchecked" )
List<String> lines = FileUtils.loadFile( apt );
for ( String line : lines )
{
if ( line.startsWith( "||" ) )
{
String[] cols = line.split( "\\|\\|" );
String[] expected =
new String[] { "", "type", "extension", "packaging", "classifier", "language", "added to classpath",
"includesDependencies", "" };
int i = 0;
for ( String col : cols )
{
assertEquals( "Wrong column header", expected[i++], col.trim() );
}
}
else if ( line.startsWith( "|" ) )
{
String[] cols = line.split( "\\|" );
String type = trimApt( cols[1] );
String extension = trimApt( cols[2], type );
String packaging = trimApt( cols[3], type );
String classifier = trimApt( cols[4] );
String language = trimApt( cols[5] );
String addedToClasspath = trimApt( cols[6] );
String includesDependencies = trimApt( cols[7] );
ArtifactHandler handler = lookup( ArtifactHandler.class, type );
assertEquals( type + " extension", handler.getExtension(), extension );
assertEquals( type + " packaging", handler.getPackaging(), packaging );
assertEquals( type + " classifier", handler.getClassifier(), classifier );
assertEquals( type + " language", handler.getLanguage(), language );
assertEquals( type + " addedToClasspath", handler.isAddedToClasspath() ? "true" : null, addedToClasspath );
assertEquals( type + " includesDependencies", handler.isIncludesDependencies() ? "true" : null, includesDependencies );
}
}
}
private String trimApt( String content, String type )
{
String value = trimApt( content );
return "= type".equals( value ) ? type : value;
}
private String trimApt( String content )
{
content = content.replace( '<', ' ' ).replace( '>', ' ' ).trim();
return ( content.length() == 0 ) ? null : content;
}
}
package org.apache.maven.artifact.handler;
/*
* 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.List;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
public class ArtifactHandlerTest
extends PlexusTestCase
{
public void testAptConsistency()
throws Exception
{
File apt = getTestFile( "src/site/apt/artifact-handlers.apt" );
@SuppressWarnings( "unchecked" )
List<String> lines = FileUtils.loadFile( apt );
for ( String line : lines )
{
if ( line.startsWith( "||" ) )
{
String[] cols = line.split( "\\|\\|" );
String[] expected =
new String[] { "", "type", "extension", "packaging", "classifier", "language", "added to classpath",
"includesDependencies", "" };
int i = 0;
for ( String col : cols )
{
assertEquals( "Wrong column header", expected[i++], col.trim() );
}
}
else if ( line.startsWith( "|" ) )
{
String[] cols = line.split( "\\|" );
String type = trimApt( cols[1] );
String extension = trimApt( cols[2], type );
String packaging = trimApt( cols[3], type );
String classifier = trimApt( cols[4] );
String language = trimApt( cols[5] );
String addedToClasspath = trimApt( cols[6] );
String includesDependencies = trimApt( cols[7] );
ArtifactHandler handler = lookup( ArtifactHandler.class, type );
assertEquals( type + " extension", handler.getExtension(), extension );
assertEquals( type + " packaging", handler.getPackaging(), packaging );
assertEquals( type + " classifier", handler.getClassifier(), classifier );
assertEquals( type + " language", handler.getLanguage(), language );
assertEquals( type + " addedToClasspath", handler.isAddedToClasspath() ? "true" : null, addedToClasspath );
assertEquals( type + " includesDependencies", handler.isIncludesDependencies() ? "true" : null, includesDependencies );
}
}
}
private String trimApt( String content, String type )
{
String value = trimApt( content );
return "= type".equals( value ) ? type : value;
}
private String trimApt( String content )
{
content = content.replace( '<', ' ' ).replace( '>', ' ' ).trim();
return ( content.length() == 0 ) ? null : content;
}
}

View File

@ -1,60 +1,60 @@
package org.apache.maven.exception;
/*
* 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.IOException;
import java.net.ConnectException;
import org.apache.maven.plugin.MojoExecutionException;
import junit.framework.TestCase;
/**
* @author <a href="mailto:baerrach@apache.org">Barrie Treloar</a>
*/
public class DefaultExceptionHandlerTest
extends TestCase
{
/**
* Running Maven under JDK7 may cause connection issues because IPv6 is used by default.
* <p>
* e.g running mvn site:run will cause Jetty to fail.
* </p>
* <p>
* The resolution is to add -Djava.net.preferIPv4Stack=true to the command line as documented in
* http://cwiki.apache.org/confluence/display/MAVEN/ConnectException
* </p>
*/
public void testJdk7ipv6()
{
ConnectException connEx = new ConnectException( "Connection refused: connect" );
IOException ioEx = new IOException( "Unable to establish loopback connection" );
ioEx.initCause( connEx );
MojoExecutionException mojoEx =
new MojoExecutionException( "Error executing Jetty: Unable to establish loopback connection", ioEx );
ExceptionHandler exceptionHandler = new DefaultExceptionHandler();
ExceptionSummary exceptionSummary = exceptionHandler.handleException( mojoEx );
String expectedReference = "http://cwiki.apache.org/confluence/display/MAVEN/ConnectException";
assertEquals( expectedReference, exceptionSummary.getReference() );
}
}
package org.apache.maven.exception;
/*
* 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.IOException;
import java.net.ConnectException;
import org.apache.maven.plugin.MojoExecutionException;
import junit.framework.TestCase;
/**
* @author <a href="mailto:baerrach@apache.org">Barrie Treloar</a>
*/
public class DefaultExceptionHandlerTest
extends TestCase
{
/**
* Running Maven under JDK7 may cause connection issues because IPv6 is used by default.
* <p>
* e.g running mvn site:run will cause Jetty to fail.
* </p>
* <p>
* The resolution is to add -Djava.net.preferIPv4Stack=true to the command line as documented in
* http://cwiki.apache.org/confluence/display/MAVEN/ConnectException
* </p>
*/
public void testJdk7ipv6()
{
ConnectException connEx = new ConnectException( "Connection refused: connect" );
IOException ioEx = new IOException( "Unable to establish loopback connection" );
ioEx.initCause( connEx );
MojoExecutionException mojoEx =
new MojoExecutionException( "Error executing Jetty: Unable to establish loopback connection", ioEx );
ExceptionHandler exceptionHandler = new DefaultExceptionHandler();
ExceptionSummary exceptionSummary = exceptionHandler.handleException( mojoEx );
String expectedReference = "http://cwiki.apache.org/confluence/display/MAVEN/ConnectException";
assertEquals( expectedReference, exceptionSummary.getReference() );
}
}

View File

@ -50,7 +50,7 @@
<plexusInterpolationVersion>1.16</plexusInterpolationVersion>
<plexusUtilsVersion>3.0.10</plexusUtilsVersion>
<sisuInjectVersion>2.3.0</sisuInjectVersion>
<wagonVersion>2.3</wagonVersion>
<wagonVersion>2.4-SNAPSHOT</wagonVersion>
<securityDispatcherVersion>1.3</securityDispatcherVersion>
<cipherVersion>1.7</cipherVersion>
<modelloVersion>1.6</modelloVersion>

View File

@ -1,74 +1,74 @@
<?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/DECORATION/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.1.0 http://maven.apache.org/xsd/decoration-1.1.0.xsd"
name="Apache Maven">
<bannerLeft>
<name>${project.name}</name>
<src>http://maven.apache.org/images/apache-maven-project.png</src>
<href>http://maven.apache.org/</href>
</bannerLeft>
<bannerRight>
<src>http://maven.apache.org/images/maventxt_logo_200.gif</src>
</bannerRight>
<skin>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-fluido-skin</artifactId>
<version>1.2.1</version>
</skin>
<body>
<breadcrumbs>
<item name="Ref" href="../" />
<item name="Maven ${project.version}" href="./" />
</breadcrumbs>
<menu name="Overview">
<item name="Introduction" href="index.html"/>
<item name="JavaDocs" href="apidocs/index.html"/>
<item name="Source Xref" href="xref/index.html"/>
<!--item name="FAQ" href="faq.html"/-->
</menu>
<menu name="Descriptors Reference">
<item name="POM" href="./maven-model/maven.html"/>
<item name="Settings" href="./maven-settings/settings.html"/>
</menu>
<menu name="Reference">
<item name="Lifecycles" href="./maven-core/lifecycles.html"/>
<item name="Plugin Bindings to Default Lifecycle" href="./maven-core/default-bindings.html"/>
<item name="Artifact Handlers" href="./maven-core/artifact-handlers.html"/>
<item name="CLI options" href="./maven-embedder/cli.html"/>
</menu>
<menu name="Development">
<item name="Maven Developer Centre" href="../../developers/index.html"/>
<item name="Maven Core ITs" href="../../core-its/index.html"/>
</menu>
<menu ref="modules"/>
<menu ref="reports"/>
</body>
<?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/DECORATION/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.1.0 http://maven.apache.org/xsd/decoration-1.1.0.xsd"
name="Apache Maven">
<bannerLeft>
<name>${project.name}</name>
<src>http://maven.apache.org/images/apache-maven-project.png</src>
<href>http://maven.apache.org/</href>
</bannerLeft>
<bannerRight>
<src>http://maven.apache.org/images/maventxt_logo_200.gif</src>
</bannerRight>
<skin>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-fluido-skin</artifactId>
<version>1.2.1</version>
</skin>
<body>
<breadcrumbs>
<item name="Ref" href="../" />
<item name="Maven ${project.version}" href="./" />
</breadcrumbs>
<menu name="Overview">
<item name="Introduction" href="index.html"/>
<item name="JavaDocs" href="apidocs/index.html"/>
<item name="Source Xref" href="xref/index.html"/>
<!--item name="FAQ" href="faq.html"/-->
</menu>
<menu name="Descriptors Reference">
<item name="POM" href="./maven-model/maven.html"/>
<item name="Settings" href="./maven-settings/settings.html"/>
</menu>
<menu name="Reference">
<item name="Lifecycles" href="./maven-core/lifecycles.html"/>
<item name="Plugin Bindings to Default Lifecycle" href="./maven-core/default-bindings.html"/>
<item name="Artifact Handlers" href="./maven-core/artifact-handlers.html"/>
<item name="CLI options" href="./maven-embedder/cli.html"/>
</menu>
<menu name="Development">
<item name="Maven Developer Centre" href="../../developers/index.html"/>
<item name="Maven Core ITs" href="../../core-its/index.html"/>
</menu>
<menu ref="modules"/>
<menu ref="reports"/>
</body>
</project>