svn commit: r1408507 - /tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
Author: olamy Date: Mon Nov 12 23:30:25 2012 New Revision: 1408507 URL: http://svn.apache.org/viewvc?rev=1408507&view=rev Log: we add artifact dependencies and projects from reactor if file (ie jar) as users can go to install/package phase so artifact.getFile is a file not a directory and not added when iterate on project.classPathElements Modified: tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java Modified: tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java?rev=1408507&r1=1408506&r2=1408507&view=diff == --- tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java (original) +++ tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java Mon Nov 12 23:30:25 2012 @@ -45,7 +45,7 @@ import java.util.Set; * @author Olivier Lamy * @since 2.0 */ -@Component( role = ClassLoaderEntriesCalculator.class ) +@Component (role = ClassLoaderEntriesCalculator.class) public class DefaultClassLoaderEntriesCalculator implements ClassLoaderEntriesCalculator { @@ -66,7 +66,7 @@ public class DefaultClassLoaderEntriesCa // add classes directories to loader try { -@SuppressWarnings( "unchecked" ) List classPathElements = request.isUseTestClassPath() +@SuppressWarnings ("unchecked") List classPathElements = request.isUseTestClassPath() ? request.getMavenProject().getTestClasspathElements() : request.getMavenProject().getCompileClasspathElements(); if ( classPathElements != null ) @@ -113,7 +113,10 @@ public class DefaultClassLoaderEntriesCa request.getLog().debug( "add dependency to webapploader " + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion() + ":" + artifact.getScope() ); -if ( !isInProjectReferences( artifact, request.getMavenProject() ) ) +// we add artifact dependencies and projects from reactor if file (ie jar) as users can go to install/package phase +// so artifact.getFile is a file not a directory and not added when iterate on project.classPathElements +if ( !isInProjectReferences( artifact, request.getMavenProject() ) || ( artifact.getFile().exists() +&& artifact.getFile().isFile() ) ) { String fileName = artifact.getFile().getName(); if ( !fileInClassLoaderEntries.contains( fileName ) ) @@ -126,6 +129,7 @@ public class DefaultClassLoaderEntriesCa { request.getLog().debug( "skip adding artifact " + artifact.getArtifactId() + " as it's in reactors" ); + } } @@ -217,7 +221,7 @@ public class DefaultClassLoaderEntriesCa { return false; } -@SuppressWarnings( "unchecked" ) Collection mavenProjects = +@SuppressWarnings ("unchecked") Collection mavenProjects = project.getProjectReferences().values(); for ( MavenProject mavenProject : mavenProjects ) { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: svn commit: r1408507 - /tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
2012/11/13 : > Author: olamy > Date: Mon Nov 12 23:30:25 2012 > New Revision: 1408507 > > URL: http://svn.apache.org/viewvc?rev=1408507&view=rev > Log: > we add artifact dependencies and projects from reactor if file (ie jar) as > users can go to install/package phase > so artifact.getFile is a file not a directory and not added when iterate on > project.classPathElements > > Modified: > > tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java > > @@ -113,7 +113,10 @@ public class DefaultClassLoaderEntriesCa > request.getLog().debug( > "add dependency to webapploader " + > artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" > + artifact.getVersion() + ":" + > artifact.getScope() ); > -if ( !isInProjectReferences( artifact, > request.getMavenProject() ) ) > +// we add artifact dependencies and projects from > reactor if file (ie jar) as users can go to install/package phase > +// so artifact.getFile is a file not a directory and not > added when iterate on project.classPathElements > +if ( !isInProjectReferences( artifact, > request.getMavenProject() ) || ( artifact.getFile().exists() > +&& artifact.getFile().isFile() ) ) > { > String fileName = artifact.getFile().getName(); > if ( !fileInClassLoaderEntries.contains( fileName ) ) Сalling both artifact.getFile().exists() && artifact.getFile().isFile() is redundant. The File.isFile() method does check for existence of the file. Best regards, Konstantin Kolinko - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: svn commit: r1408507 - /tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
2012/11/13 Konstantin Kolinko : > 2012/11/13 : >> Author: olamy >> Date: Mon Nov 12 23:30:25 2012 >> New Revision: 1408507 >> >> URL: http://svn.apache.org/viewvc?rev=1408507&view=rev >> Log: >> we add artifact dependencies and projects from reactor if file (ie jar) as >> users can go to install/package phase >> so artifact.getFile is a file not a directory and not added when iterate on >> project.classPathElements >> >> Modified: >> >> tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java >> > >> @@ -113,7 +113,10 @@ public class DefaultClassLoaderEntriesCa >> request.getLog().debug( >> "add dependency to webapploader " + >> artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" >> + artifact.getVersion() + ":" + >> artifact.getScope() ); >> -if ( !isInProjectReferences( artifact, >> request.getMavenProject() ) ) >> +// we add artifact dependencies and projects from >> reactor if file (ie jar) as users can go to install/package phase >> +// so artifact.getFile is a file not a directory and >> not added when iterate on project.classPathElements >> +if ( !isInProjectReferences( artifact, >> request.getMavenProject() ) || ( artifact.getFile().exists() >> +&& artifact.getFile().isFile() ) ) >> { >> String fileName = artifact.getFile().getName(); >> if ( !fileInClassLoaderEntries.contains( fileName ) >> ) > > > Сalling both artifact.getFile().exists() && > artifact.getFile().isFile() is redundant. > > The File.isFile() method does check for existence of the file. good catch. Fixed. Thanks for review! > > Best regards, > Konstantin Kolinko > > - > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > -- Olivier Lamy Talend: http://coders.talend.com http://twitter.com/olamy | http://linkedin.com/in/olamy - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org