You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Sufie Seifoddini <su...@sufie.com> on 2010/02/08 16:57:31 UTC

Having problems parsing profiles.xml

Hi everyone,
 
I am in the process of cleaning up some pom files and have pulled the dependencies and build elements out of the pom.xml file into profiles.xml.  I keep getting errors that the element build is not recognized.  When I comment out build, I get the same error on dependencies.   Is there a known issue or any specific setup required?
 
 
profiles.xml:

<profilesXml>
   <profiles>
   <profile>
      <id>development</id>
      <activation>
         <property>
            <name>environment.type</name>
            <value>dev</value>
         </property>
      </activation>
      <build>
         <plugins>
            <plugin>
               <artifactId>maven-compiler-plugin</artifactId>
               <configuration>
                  <source>1.6</source>
                  <target>1.6</target>
                  <encoding>UTF-8</encoding>
                  <debug>true</debug>
                  <optimize>false</optimize>
               </configuration>
            </plugin>
         </plugins>
      </build>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

   </profile>
   </profiles>
</profilesXml>

 
Snippet of exception thrown:

at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:200)
at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:632)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:515)
at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:419)
... 12 more
Caused by: org.apache.maven.profiles.activation.ProfileActivationException: Cannot parse profiles.xml resource from directory: /Users/sufie/chb/MySubscription/connector-api
at org.apache.maven.project.DefaultMavenProjectBuilder.loadProjectExternalProfiles(DefaultMavenProjectBuilder.java:1556)
at org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1192)
... 18 more
Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: Unrecognised tag: 'build' (position: START_TAG seen ...</activation>\n      <build>... @11:14) 
at org.apache.maven.profiles.io.xpp3.ProfilesXpp3Reader.parseProfile(ProfilesXpp3Reader.java:699)
at org.apache.maven.profiles.io.xpp3.ProfilesXpp3Reader.parseProfilesRoot(ProfilesXpp3Reader.java:748)
at org.apache.maven.profiles.io.xpp3.ProfilesXpp3Reader.read(ProfilesXpp3Reader.java:1227)
at org.apache.maven.profiles.io.xpp3.ProfilesXpp3Reader.read(ProfilesXpp3Reader.java:1241)
at org.apache.maven.profiles.DefaultMavenProfilesBuilder.buildProfiles(DefaultMavenProfilesBuilder.java:78)
at org.apache.maven.project.DefaultMavenProjectBuilder.loadProjectExternalProfiles(DefaultMavenProjectBuilder.java:1528)



 
Any feedback or advise is highly appreciated.
 Sufie
sufie@sufie.com

Re: Having problems parsing profiles.xml

Posted by rsaddey <rw...@saddey.net>.

Justin Edelson wrote:
> 
> [...]
> According to 
> http://maven.apache.org/guides/introduction/introduction-to-profiles.html, 
> only repositories, pluginRepositories, and properties can be in profiles 
> defined in the profiles.xml file.
> [...]
> 

Yes, there's a xsd for profiles too: 
http://view-source:http://maven.apache.org/xsd/profiles-1.0.0.xsd
profiles-1.0.0.xsd 
-- 
View this message in context: http://n2.nabble.com/Having-problems-parsing-profiles-xml-tp4534999p4553080.html
Sent from the maven users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Having problems parsing profiles.xml

Posted by Justin Edelson <ju...@gmail.com>.
On 2/8/10 11:51 AM, Sufie Seifoddini wrote:
> Thanks for the feedback.
>
> What is recommended practice?  I am new to maven and it seemed that the current docs and books point to using profiles.  I would like to know what experienced users recommend as an alternative to profiles that will be compatible with 3 moving forward.
>    
AFAIK, only support for the file profiles.xml is being removed. Support 
for profiles in general is being kept.
> With regards to the current version though, I believe the below profiles.xml file is correct and should be parsed.
>    
According to 
http://maven.apache.org/guides/introduction/introduction-to-profiles.html, 
only repositories, pluginRepositories, and properties can be in profiles 
defined in the profiles.xml file.

Justin
> My current output from mvn -v
>
> Apache Maven 2.2.0 (r788681; 2009-06-26 06:04:01-0700)
> Java version: 1.6.0_17
> Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
> Default locale: en_US, platform encoding: MacRoman
> OS name: "mac os x" version: "10.6.2" arch: "x86_64" Family: "mac"
>   Sufie
>
>
>
>
>
>
> ________________________________
> From: Stephen Connolly<st...@gmail.com>
> To: Maven Users List<us...@maven.apache.org>
> Sent: Mon, February 8, 2010 8:21:26 AM
> Subject: Re: Having problems parsing profiles.xml
>
> Just so that you know, profiles.xml is removed in Maven 3.x.... so you might
> want to rethink that refactoring/cleanup you are doing!
>
> (IIRC, Jason is fine if somebody wants to write the support for it back in
> providing that they do not degrade the performance)
>
> -Stephen
>
> On 8 February 2010 15:57, Sufie Seifoddini<su...@sufie.com>  wrote:
>
>    
>> Hi everyone,
>>
>> I am in the process of cleaning up some pom files and have pulled the
>> dependencies and build elements out of the pom.xml file into profiles.xml.
>>   I keep getting errors that the element build is not recognized.  When I
>> comment out build, I get the same error on dependencies.   Is there a known
>> issue or any specific setup required?
>>
>>
>> profiles.xml:
>>
>> <profilesXml>
>>    <profiles>
>>    <profile>
>>       <id>development</id>
>>       <activation>
>>          <property>
>>             <name>environment.type</name>
>>             <value>dev</value>
>>          </property>
>>       </activation>
>>       <build>
>>          <plugins>
>>             <plugin>
>>                <artifactId>maven-compiler-plugin</artifactId>
>>                <configuration>
>>                   <source>1.6</source>
>>                   <target>1.6</target>
>>                   <encoding>UTF-8</encoding>
>>                   <debug>true</debug>
>>                   <optimize>false</optimize>
>>                </configuration>
>>             </plugin>
>>          </plugins>
>>       </build>
>>   <dependencies>
>>     <dependency>
>>       <groupId>junit</groupId>
>>       <artifactId>junit</artifactId>
>>       <version>3.8.1</version>
>>       <scope>test</scope>
>>     </dependency>
>>   </dependencies>
>>
>>    </profile>
>>    </profiles>
>> </profilesXml>
>>
>>
>> Snippet of exception thrown:
>>
>> at
>> org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:200)
>> at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:632)
>> at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:515)
>> at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:419)
>> ... 12 more
>> Caused by: org.apache.maven.profiles.activation.ProfileActivationException:
>> Cannot parse profiles.xml resource from directory:
>> /Users/sufie/chb/MySubscription/connector-api
>> at
>> org.apache.maven.project.DefaultMavenProjectBuilder.loadProjectExternalProfiles(DefaultMavenProjectBuilder.java:1556)
>> at
>> org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1192)
>> ... 18 more
>> Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException:
>> Unrecognised tag: 'build' (position: START_TAG seen ...</activation>\n
>>   <build>... @11:14)
>> at
>> org.apache.maven.profiles.io.xpp3.ProfilesXpp3Reader.parseProfile(ProfilesXpp3Reader.java:699)
>> at
>> org.apache.maven.profiles.io.xpp3.ProfilesXpp3Reader.parseProfilesRoot(ProfilesXpp3Reader.java:748)
>> at
>> org.apache.maven.profiles.io.xpp3.ProfilesXpp3Reader.read(ProfilesXpp3Reader.java:1227)
>> at
>> org.apache.maven.profiles.io.xpp3.ProfilesXpp3Reader.read(ProfilesXpp3Reader.java:1241)
>> at
>> org.apache.maven.profiles.DefaultMavenProfilesBuilder.buildProfiles(DefaultMavenProfilesBuilder.java:78)
>> at
>> org.apache.maven.project.DefaultMavenProjectBuilder.loadProjectExternalProfiles(DefaultMavenProjectBuilder.java:1528)
>>
>>
>>
>>
>> Any feedback or advise is highly appreciated.
>>   Sufie
>> sufie@sufie.com
>>
>>      
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Having problems parsing profiles.xml

Posted by Sufie Seifoddini <su...@sufie.com>.
Thanks for the feedback.  

What is recommended practice?  I am new to maven and it seemed that the current docs and books point to using profiles.  I would like to know what experienced users recommend as an alternative to profiles that will be compatible with 3 moving forward.

With regards to the current version though, I believe the below profiles.xml file is correct and should be parsed.  

My current output from mvn -v

Apache Maven 2.2.0 (r788681; 2009-06-26 06:04:01-0700)
Java version: 1.6.0_17
Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x" version: "10.6.2" arch: "x86_64" Family: "mac"
 Sufie 






________________________________
From: Stephen Connolly <st...@gmail.com>
To: Maven Users List <us...@maven.apache.org>
Sent: Mon, February 8, 2010 8:21:26 AM
Subject: Re: Having problems parsing profiles.xml

Just so that you know, profiles.xml is removed in Maven 3.x.... so you might
want to rethink that refactoring/cleanup you are doing!

(IIRC, Jason is fine if somebody wants to write the support for it back in
providing that they do not degrade the performance)

-Stephen

On 8 February 2010 15:57, Sufie Seifoddini <su...@sufie.com> wrote:

> Hi everyone,
>
> I am in the process of cleaning up some pom files and have pulled the
> dependencies and build elements out of the pom.xml file into profiles.xml.
>  I keep getting errors that the element build is not recognized.  When I
> comment out build, I get the same error on dependencies.   Is there a known
> issue or any specific setup required?
>
>
> profiles.xml:
>
> <profilesXml>
>   <profiles>
>   <profile>
>      <id>development</id>
>      <activation>
>         <property>
>            <name>environment.type</name>
>            <value>dev</value>
>         </property>
>      </activation>
>      <build>
>         <plugins>
>            <plugin>
>               <artifactId>maven-compiler-plugin</artifactId>
>               <configuration>
>                  <source>1.6</source>
>                  <target>1.6</target>
>                  <encoding>UTF-8</encoding>
>                  <debug>true</debug>
>                  <optimize>false</optimize>
>               </configuration>
>            </plugin>
>         </plugins>
>      </build>
>  <dependencies>
>    <dependency>
>      <groupId>junit</groupId>
>      <artifactId>junit</artifactId>
>      <version>3.8.1</version>
>      <scope>test</scope>
>    </dependency>
>  </dependencies>
>
>   </profile>
>   </profiles>
> </profilesXml>
>
>
> Snippet of exception thrown:
>
> at
> org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:200)
> at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:632)
> at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:515)
> at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:419)
> ... 12 more
> Caused by: org.apache.maven.profiles.activation.ProfileActivationException:
> Cannot parse profiles.xml resource from directory:
> /Users/sufie/chb/MySubscription/connector-api
> at
> org.apache.maven.project.DefaultMavenProjectBuilder.loadProjectExternalProfiles(DefaultMavenProjectBuilder.java:1556)
> at
> org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1192)
> ... 18 more
> Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException:
> Unrecognised tag: 'build' (position: START_TAG seen ...</activation>\n
>  <build>... @11:14)
> at
> org.apache.maven.profiles.io.xpp3.ProfilesXpp3Reader.parseProfile(ProfilesXpp3Reader.java:699)
> at
> org.apache.maven.profiles.io.xpp3.ProfilesXpp3Reader.parseProfilesRoot(ProfilesXpp3Reader.java:748)
> at
> org.apache.maven.profiles.io.xpp3.ProfilesXpp3Reader.read(ProfilesXpp3Reader.java:1227)
> at
> org.apache.maven.profiles.io.xpp3.ProfilesXpp3Reader.read(ProfilesXpp3Reader.java:1241)
> at
> org.apache.maven.profiles.DefaultMavenProfilesBuilder.buildProfiles(DefaultMavenProfilesBuilder.java:78)
> at
> org.apache.maven.project.DefaultMavenProjectBuilder.loadProjectExternalProfiles(DefaultMavenProjectBuilder.java:1528)
>
>
>
>
> Any feedback or advise is highly appreciated.
>  Sufie
> sufie@sufie.com
>

Re: Having problems parsing profiles.xml

Posted by Stephen Connolly <st...@gmail.com>.
Just so that you know, profiles.xml is removed in Maven 3.x.... so you might
want to rethink that refactoring/cleanup you are doing!

(IIRC, Jason is fine if somebody wants to write the support for it back in
providing that they do not degrade the performance)

-Stephen

On 8 February 2010 15:57, Sufie Seifoddini <su...@sufie.com> wrote:

> Hi everyone,
>
> I am in the process of cleaning up some pom files and have pulled the
> dependencies and build elements out of the pom.xml file into profiles.xml.
>  I keep getting errors that the element build is not recognized.  When I
> comment out build, I get the same error on dependencies.   Is there a known
> issue or any specific setup required?
>
>
> profiles.xml:
>
> <profilesXml>
>   <profiles>
>   <profile>
>      <id>development</id>
>      <activation>
>         <property>
>            <name>environment.type</name>
>            <value>dev</value>
>         </property>
>      </activation>
>      <build>
>         <plugins>
>            <plugin>
>               <artifactId>maven-compiler-plugin</artifactId>
>               <configuration>
>                  <source>1.6</source>
>                  <target>1.6</target>
>                  <encoding>UTF-8</encoding>
>                  <debug>true</debug>
>                  <optimize>false</optimize>
>               </configuration>
>            </plugin>
>         </plugins>
>      </build>
>  <dependencies>
>    <dependency>
>      <groupId>junit</groupId>
>      <artifactId>junit</artifactId>
>      <version>3.8.1</version>
>      <scope>test</scope>
>    </dependency>
>  </dependencies>
>
>   </profile>
>   </profiles>
> </profilesXml>
>
>
> Snippet of exception thrown:
>
> at
> org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:200)
> at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:632)
> at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:515)
> at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:419)
> ... 12 more
> Caused by: org.apache.maven.profiles.activation.ProfileActivationException:
> Cannot parse profiles.xml resource from directory:
> /Users/sufie/chb/MySubscription/connector-api
> at
> org.apache.maven.project.DefaultMavenProjectBuilder.loadProjectExternalProfiles(DefaultMavenProjectBuilder.java:1556)
> at
> org.apache.maven.project.DefaultMavenProjectBuilder.assembleLineage(DefaultMavenProjectBuilder.java:1192)
> ... 18 more
> Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException:
> Unrecognised tag: 'build' (position: START_TAG seen ...</activation>\n
>  <build>... @11:14)
> at
> org.apache.maven.profiles.io.xpp3.ProfilesXpp3Reader.parseProfile(ProfilesXpp3Reader.java:699)
> at
> org.apache.maven.profiles.io.xpp3.ProfilesXpp3Reader.parseProfilesRoot(ProfilesXpp3Reader.java:748)
> at
> org.apache.maven.profiles.io.xpp3.ProfilesXpp3Reader.read(ProfilesXpp3Reader.java:1227)
> at
> org.apache.maven.profiles.io.xpp3.ProfilesXpp3Reader.read(ProfilesXpp3Reader.java:1241)
> at
> org.apache.maven.profiles.DefaultMavenProfilesBuilder.buildProfiles(DefaultMavenProfilesBuilder.java:78)
> at
> org.apache.maven.project.DefaultMavenProjectBuilder.loadProjectExternalProfiles(DefaultMavenProjectBuilder.java:1528)
>
>
>
>
> Any feedback or advise is highly appreciated.
>  Sufie
> sufie@sufie.com
>