Is this in a plugin or in standalone code?

The APIs aren't really designed for use outside of the Maven
environment at this stage.

- Brett

2008/10/3 Jacob Danner <[EMAIL PROTECTED]>:
> Hey Brett,
> Thanks for taking a peek. I'm not really constructing the project by
> hand. I'm trying to access the model from an existing POM. Since the
> POM is using the default project structure the sourceDirectory element
> is never defined.
>
> I did look into your suggestion and got a new error:
> DefaultProjectBuilderConfiguration pbc = new
> DefaultProjectBuilderConfiguration();
> MavenProjectBuilder mpb = new DefaultMavenProjectBuilder();
> MavenProject mp = mpb.build(new File(pom.toURI()), new
> DefaultProjectBuilderConfiguration());
>
> produces an NPE for me
> org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:499)
> org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:202)
>
> Thanks,
> -jacobd
>
>
> On Thu, Oct 2, 2008 at 9:05 PM, Brett Porter <[EMAIL PROTECTED]> wrote:
>> Is there a reason you are constructing the project by hand, rather
>> than using MavenProjectBuilder which will process inheritence (which
>> includes the defaults, coming from the "super POM").
>>
>> - Brett
>>
>> 2008/10/3 Jacob Danner <[EMAIL PROTECTED]>:
>>> Hi,
>>> Sorry if this is a dumb question, I queried nabble and checked all the
>>> docs I could find for an answer in advance.
>>>
>>> I'm trying to find out how I can get the default values for a maven
>>> pom. The POM reference (http://maven.apache.org/pom.html#Directories)
>>> notes that the default sourceDirectory for a POM is:
>>>
>>> ${basedir}/src/main/java
>>>
>>> and if the build/sourceDirectory element is not defined in the POM a call to
>>>
>>> org.apache.maven.model.Model.getBuild().getSourceDirectory()
>>> returns null.
>>> I would like to know if there is a way (other than hard coding a value
>>> to src/main/java) for me to retrieve the sourceDirectory value.
>>>
>>> My code looks similar to:
>>>
>>>            String src = ...
>>>            URL pom = ...
>>>            MavenXpp3Reader mxr = new MavenXpp3Reader();
>>>            Model m = null;
>>>            m = mxr.read(new InputStreamReader(pom.openStream()));
>>>
>>>            MavenProject mp = new MavenProject(m);
>>>
>>>            if(mp.getBuild().getSourceDirectory() == null)
>>>                  src = <HOW _TO_GET_DEFAULT_SRC_DIRECTORY>
>>>
>>> Any help is appreciated,
>>> -jacobd
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>>
>>
>> --
>> Brett Porter
>> Blog: http://blogs.exist.com/bporter/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Brett Porter
Blog: http://blogs.exist.com/bporter/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to