[MRM-1779] pom artifacts cannot be searched on Archiva 1.4-M4

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1525882 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-09-24 13:31:10 +00:00
parent 5a63e2b407
commit ef1759b856
5 changed files with 21 additions and 2 deletions

View File

@ -123,7 +123,7 @@ public class MavenRepositorySearch
// we retun only artifacts without classifier in quick search, olamy cannot find a way to say with this field empty
// FIXME cannot find a way currently to setup this in constructQuery !!!
return search( limits, q, indexingContextIds, NoClassifierArtifactInfoFilter.LIST, selectedRepos, false );
return search( limits, q, indexingContextIds, NoClassifierArtifactInfoFilter.LIST, selectedRepos, true );
}

View File

@ -208,6 +208,13 @@ public abstract class AbstractMavenRepositorySearch
{
assertTrue( "file not exists " + artifactFile.getPath(), artifactFile.exists() );
ArtifactContext ac = artifactContextProducer.getArtifactContext( context, artifactFile );
if ( artifactFile.getPath().endsWith( ".pom" ) )
{
ac.getArtifactInfo().fextension = "pom";
ac.getArtifactInfo().packaging = "pom";
ac.getArtifactInfo().classifier = "pom";
}
nexusIndexer.addArtifactToIndex( ac, context );
context.updateTimestamp( true );
}

View File

@ -85,6 +85,10 @@ public class MavenRepositorySearchTest
files.add( new File( FileUtil.getBasedir(), "src/test/" + TEST_REPO_1
+ "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
files.add( new File( FileUtil.getBasedir(), "src/test/" + TEST_REPO_1
+ "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.pom" ) );
files.add( new File( FileUtil.getBasedir(), "src/test/" + TEST_REPO_1
+ "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0-sources.jar" ) );

View File

@ -160,6 +160,14 @@ public class ArchivaIndexingTaskExecutor
if ( ac != null )
{
// MRM-1779 pom must be indexed too
// TODO make that configurable?
if ( artifactFile.getPath().endsWith( ".pom" ) )
{
ac.getArtifactInfo().fextension = "pom";
ac.getArtifactInfo().packaging = "pom";
ac.getArtifactInfo().classifier = "pom";
}
if ( indexingTask.getAction().equals( ArtifactIndexingTask.Action.ADD ) )
{
//IndexSearcher s = context.getIndexSearcher();

View File

@ -1951,7 +1951,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","select2","knockout","kno
this.classifier=ko.observable();
//private boolean includePomArtifacts = false;
this.includePomArtifacts=ko.observable(false);
this.includePomArtifacts=ko.observable(true);
this.classifier=ko.observable();
}