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<[email protected]>
To: Maven Users List<[email protected]>
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<[email protected]>  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
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to