take a look at buildhelper-maven-plugin, it has code dealing with svn
info output

BTW, perhaps we should ask svn provider to support svn info command.
file a JIRA is a good start

-D

On Thu, Jan 8, 2009 at 10:42 AM, Nord, James <jn...@nds.com> wrote:
> Hi all,
>
> I've been trying to write an enforcer plugin that will validate the SCM
> information contained in a POM actually reflects the actual repository
> location.  I'm only concerned with SVN.
>
> Basically I am trying to do is a "svn info project.getBaseDir()" and
> compare the repository url that comes back with the one defined in the
> SCM tag.
>
> I've been failing misserably as using I can not construct a
> SCMProviderRepository with the File argument. even though the svn
> provider supports getting the url from a file location[1] it just ends
> up throwing a null pointer exception[2].
>
> I have managed to get the following code to work - but it doesn't work
> out where the repo is from the .svn files.  How can I adapt it to do so
> it will work with the local file location not the remote location- I'm
> tearing my hair out!
>
>
>        String devSCM = project.getScm().getDeveloperConnection();
>        String devSVN = devSCM.replaceFirst("scm:svn:", "");
>        ScmRepository scmRepo = scmManger.makeScmRepository(devSCM);
>        log.warn("Using " + base + " as the base directory");
>        ScmProvider provider = scmManger.getProviderByUrl(devSCM);
>        if (provider instanceof AbstractSvnScmProvider) {
>             AbstractSvnScmProvider svnProvider =
> (AbstractSvnScmProvider)provider;
>            // following returns null and a n.p.e is later thrown by
> AbstractCommand.execute(AbstractCommand.java:49)
>            //ScmProviderRepository providerRepo =
> svnProvider.makeProviderScmRepository(project.getBaseDir());
>             ScmProviderRepository providerRepo =
> svnProvider.makeProviderScmRepository(devSVN, '\u0000');
>             ScmFileSet fileSet = new ScmFileSet(project.getBasedir(),
> "pom.xml");
>            SvnInfoScmResult infoResult = svnProvider.info(providerRepo,
> fileSet, null);
>            if (infoResult.isSuccess()) {
>                ....
>            }
>        }
>
>
>
> [1]
> http://maven.apache.org/scm/xref/org/apache/maven/scm/provider/svn/Abstr
> actSvnScmProvider.html#110
>
> Regards,
>
>    /James
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to