You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ca...@apache.org on 2006/10/24 15:36:55 UTC
svn commit: r467331 - in /maven/plugins/trunk/maven-eclipse-plugin/src:
main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java
test/java/org/apache/maven/plugin/eclipse/MakeArtifactsTest.java
Author: carlos
Date: Tue Oct 24 06:36:54 2006
New Revision: 467331
URL: http://svn.apache.org/viewvc?view=rev&rev=467331
Log:
Use smaller groups and a parent pom for eclipse projects
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/MakeArtifactsTest.java
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java?view=diff&rev=467331&r1=467330&r2=467331
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java Tue Oct 24 06:36:54 2006
@@ -24,6 +24,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
+import java.util.StringTokenizer;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
@@ -36,8 +37,8 @@
import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.model.Dependency;
-import org.apache.maven.model.License;
import org.apache.maven.model.Model;
+import org.apache.maven.model.Parent;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -245,12 +246,11 @@
if ( groupId.startsWith( "org.eclipse" ) )
{
- // infer license for know projects, everything at eclipse is licensed under EPL
- // maybe too simplicistic, but better than nothing
- License license = new License();
- license.setName( "Eclipse Public License - v 1.0" );
- license.setUrl( "http://www.eclipse.org/org/documents/epl-v10.html" );
- model.addLicense( license );
+ Parent parent = new Parent();
+ parent.setGroupId( "org.eclipse" );
+ parent.setArtifactId( "eclipse" );
+ parent.setVersion( "1" );
+ model.setParent( parent );
}
if ( deps.length > 0 )
@@ -302,15 +302,23 @@
}
/**
- * Get the group id as the two first tokens in artifacts Id (e.g. <code>org.eclipse</code>)
+ * Get the group id as the three first tokens in artifacts Id (e.g. <code>org.eclipse.jdt</code>)
* @param artifactId artifact id
* @return group id
*/
- private String createGroupId( String artifactId )
+ String createGroupId( String artifactId )
{
if ( StringUtils.countMatches( artifactId, "." ) > 1 )
{
- return StringUtils.substring( artifactId, 0, artifactId.indexOf( ".", artifactId.indexOf( "." ) + 1 ) );
+ StringTokenizer st = new StringTokenizer( artifactId, "." );
+ int i = 0;
+ String groupId = "";
+ while ( st.hasMoreTokens() && ( i < 3 ) )
+ {
+ groupId += "." + st.nextToken();
+ i++;
+ }
+ return groupId.substring( 1 );
}
return artifactId;
}
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/MakeArtifactsTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/MakeArtifactsTest.java?view=diff&rev=467331&r1=467330&r2=467331
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/MakeArtifactsTest.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/MakeArtifactsTest.java Tue Oct 24 06:36:54 2006
@@ -61,4 +61,13 @@
assertEquals( "org.eclipse.core.expressions", deps[3].getArtifactId() );
assertEquals( "[3.2.0,4.0.0)", deps[3].getVersion() );
}
+
+ public void testCreateGroupId()
+ {
+ assertEquals( "test", mojo.createGroupId( "test" ) );
+ assertEquals( "org.eclipse", mojo.createGroupId( "org.eclipse" ) );
+ assertEquals( "org.eclipse.jdt", mojo.createGroupId( "org.eclipse.jdt" ) );
+ assertEquals( "org.eclipse.jdt", mojo.createGroupId( "org.eclipse.jdt.apt" ) );
+ assertEquals( "org.eclipse.jdt", mojo.createGroupId( "org.eclipse.jdt.apt.core" ) );
+ }
}
Re: svn commit: r467331 - in /maven/plugins/trunk/maven-eclipse-plugin/src: main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java test/java/org/apache/maven/plugin/eclipse/MakeArtifactsTest.java
Posted by Carlos Sanchez <ca...@apache.org>.
parent pom can't change in it's basic "build required" info (eg.
dependencies), but we can add more info like license, url,...
it's better to centralize it than have it copied all over
On 10/30/06, Fabrizio Giustina <fg...@apache.org> wrote:
> On 10/30/06, Carlos Sanchez <ca...@apache.org> wrote:
> > There are a lot of common things to all eclipse projects like license.
> > Having the license all over all projects is not easy fo fix,
> > change,... Same problem for all common info
>
>
> but given the actual repository policy, also the parent pom can't
> change: if you fix the license in the parent pom you will have to
> deploy a new version and update all the children pom to use a
> different parent. And since all the poms are automatically generated
> by the eclipse plugin I can't see a big difference here...
>
> fabrizio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
--
I could give you my word as a Spaniard.
No good. I've known too many Spaniards.
-- The Princess Bride
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: svn commit: r467331 - in /maven/plugins/trunk/maven-eclipse-plugin/src: main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java test/java/org/apache/maven/plugin/eclipse/MakeArtifactsTest.java
Posted by Fabrizio Giustina <fg...@apache.org>.
On 10/30/06, Carlos Sanchez <ca...@apache.org> wrote:
> There are a lot of common things to all eclipse projects like license.
> Having the license all over all projects is not easy fo fix,
> change,... Same problem for all common info
but given the actual repository policy, also the parent pom can't
change: if you fix the license in the parent pom you will have to
deploy a new version and update all the children pom to use a
different parent. And since all the poms are automatically generated
by the eclipse plugin I can't see a big difference here...
fabrizio
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: svn commit: r467331 - in /maven/plugins/trunk/maven-eclipse-plugin/src: main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java test/java/org/apache/maven/plugin/eclipse/MakeArtifactsTest.java
Posted by Carlos Sanchez <ca...@apache.org>.
On 10/28/06, Fabrizio Giustina <fg...@apache.org> wrote:
> Hi,
>
> > On 10/24/06, Fabrizio Giustina <fg...@gmail.com> wrote:
>
> > > what is the benefit of having a parent pom? I would prefer keeping
> > > poms self-contained, an empty parent seems useless at the moment (all
> > > the values comes from the OSGI manifest).
>
> On 10/24/06, Carlos Sanchez <ca...@apache.org> wrote:
> > I'm working on deploying parent and all plugins to central repository.
>
> I still didn't get the reason why having that parent pom could be useful...
There are a lot of common things to all eclipse projects like license.
Having the license all over all projects is not easy fo fix,
change,... Same problem for all common info
>
> I actually improved the make-artifacts mojo in order to being able to
> deploy generated artifacts
cool, I like that
> (we needed good metadata, so it's better to
> only use maven for deploying eclipse plugins) and I temporarily
> commented out the parent pom addition.
> I am currently testing it and I wanted to avoid the need for a parent
> pom in order to be able to deploy to a clean remote repo, where
> everything is handled by this plugin.
> Carlos, let me know if and why you think it's better to put the parent back
>
> fabrizio
>
--
I could give you my word as a Spaniard.
No good. I've known too many Spaniards.
-- The Princess Bride
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: svn commit: r467331 - in /maven/plugins/trunk/maven-eclipse-plugin/src: main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java test/java/org/apache/maven/plugin/eclipse/MakeArtifactsTest.java
Posted by Fabrizio Giustina <fg...@apache.org>.
Hi,
> On 10/24/06, Fabrizio Giustina <fg...@gmail.com> wrote:
> > what is the benefit of having a parent pom? I would prefer keeping
> > poms self-contained, an empty parent seems useless at the moment (all
> > the values comes from the OSGI manifest).
On 10/24/06, Carlos Sanchez <ca...@apache.org> wrote:
> I'm working on deploying parent and all plugins to central repository.
I still didn't get the reason why having that parent pom could be useful...
I actually improved the make-artifacts mojo in order to being able to
deploy generated artifacts (we needed good metadata, so it's better to
only use maven for deploying eclipse plugins) and I temporarily
commented out the parent pom addition.
I am currently testing it and I wanted to avoid the need for a parent
pom in order to be able to deploy to a clean remote repo, where
everything is handled by this plugin.
Carlos, let me know if and why you think it's better to put the parent back
fabrizio
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: svn commit: r467331 - in /maven/plugins/trunk/maven-eclipse-plugin/src: main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java test/java/org/apache/maven/plugin/eclipse/MakeArtifactsTest.java
Posted by Carlos Sanchez <ca...@apache.org>.
On 10/24/06, Fabrizio Giustina <fg...@apache.org> wrote:
> On 10/24/06, Carlos Sanchez <ca...@apache.org> wrote:
> > I'm working on deploying parent and all plugins to central repository.
>
> wow, that's great :)
>
> just a question/decision to take before going on, anyway: at the
> moment eclipse poms uses "eclipse-plugin" as packaging. I was thinking
> to convert them to standard "jar" packaging, after the latest changes
> to the eclipse plugin.
sounds right, I'll do that. Probably i'll create a staging repo where
we can test before moving things to central
>
> The reason is that any standard jar could be an osgi bundle, simply
> adding an appropriate manifest. I guess that in future there will be
> more and more jars in the repo that could be used as bundles (although
> they use the standard jar packaging): for example spring 2.1 will
> surely have osgi manifests in the standard distribution.
>
> That's the reason (along with a problem/bug in the artifactHandler in
> how it detects the packaging) why I recently made the eclipse plugin
> able to detect which jar is an osgi bundle by simply looking at its
> manifest. The natural evolution for this approach would be deploying
> also the eclipse jars as standard "jar" artifacts.
> This is one of the reason why all these features in the maven eclipse
> plugin have never been released: I am actually actively working to the
> development of eclipse RCP applications and I am now deeply
> testing/using/enhancing the maven-eclipse-plugin support for eclipse
> plugins and osgi bundles in general...
>
> WDYT? If you want to deploy all the artifacts to the central repo the
> packaging decision has to be taken now...
>
>
> PS. and a reminder, probably you already know that:
> you know that metadata will be absolutely required for eclipse
> artifacts? Transitive dependencies, coming from the osgi manifest, are
> usually declared with a version range and dependency resolution will
> fail if metadata are not available
i'd like an automated solution to regenerate missing metadata but
maybe somebody can provide a shell script for now?
>
>
> fabrizio
>
>
> >
> > On 10/24/06, Fabrizio Giustina <fg...@gmail.com> wrote:
> > > Hi Carlos,
> > >
> > > On 10/24/06, carlos@apache.org <ca...@apache.org> wrote:
> > > > Author: carlos
> > > > Date: Tue Oct 24 06:36:54 2006
> > > > New Revision: 467331
> > > >
> > > > URL: http://svn.apache.org/viewvc?view=rev&rev=467331
> > > > Log: > Use smaller groups and a parent pom for eclipse projects
> > >
> > > what is the benefit of having a parent pom? I would prefer keeping
> > > poms self-contained, an empty parent seems useless at the moment (all
> > > the values comes from the OSGI manifest).
> > >
> > > and what about the license that was added to the pom, now removed? Do
> > > you plan to deplo y a parent pom for that?
> > >
> > > fabrizio
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: dev-help@maven.apache.org
> > >
> > >
> >
> >
> > --
> > I could give you my word as a Spaniard.
> > No good. I've known too many Spaniards.
> > -- The Princess Bride
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
--
I could give you my word as a Spaniard.
No good. I've known too many Spaniards.
-- The Princess Bride
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: svn commit: r467331 - in /maven/plugins/trunk/maven-eclipse-plugin/src: main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java test/java/org/apache/maven/plugin/eclipse/MakeArtifactsTest.java
Posted by Fabrizio Giustina <fg...@apache.org>.
On 10/24/06, Carlos Sanchez <ca...@apache.org> wrote:
> I'm working on deploying parent and all plugins to central repository.
wow, that's great :)
just a question/decision to take before going on, anyway: at the
moment eclipse poms uses "eclipse-plugin" as packaging. I was thinking
to convert them to standard "jar" packaging, after the latest changes
to the eclipse plugin.
The reason is that any standard jar could be an osgi bundle, simply
adding an appropriate manifest. I guess that in future there will be
more and more jars in the repo that could be used as bundles (although
they use the standard jar packaging): for example spring 2.1 will
surely have osgi manifests in the standard distribution.
That's the reason (along with a problem/bug in the artifactHandler in
how it detects the packaging) why I recently made the eclipse plugin
able to detect which jar is an osgi bundle by simply looking at its
manifest. The natural evolution for this approach would be deploying
also the eclipse jars as standard "jar" artifacts.
This is one of the reason why all these features in the maven eclipse
plugin have never been released: I am actually actively working to the
development of eclipse RCP applications and I am now deeply
testing/using/enhancing the maven-eclipse-plugin support for eclipse
plugins and osgi bundles in general...
WDYT? If you want to deploy all the artifacts to the central repo the
packaging decision has to be taken now...
PS. and a reminder, probably you already know that:
you know that metadata will be absolutely required for eclipse
artifacts? Transitive dependencies, coming from the osgi manifest, are
usually declared with a version range and dependency resolution will
fail if metadata are not available
fabrizio
>
> On 10/24/06, Fabrizio Giustina <fg...@gmail.com> wrote:
> > Hi Carlos,
> >
> > On 10/24/06, carlos@apache.org <ca...@apache.org> wrote:
> > > Author: carlos
> > > Date: Tue Oct 24 06:36:54 2006
> > > New Revision: 467331
> > >
> > > URL: http://svn.apache.org/viewvc?view=rev&rev=467331
> > > Log: > Use smaller groups and a parent pom for eclipse projects
> >
> > what is the benefit of having a parent pom? I would prefer keeping
> > poms self-contained, an empty parent seems useless at the moment (all
> > the values comes from the OSGI manifest).
> >
> > and what about the license that was added to the pom, now removed? Do
> > you plan to deplo y a parent pom for that?
> >
> > fabrizio
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> >
> >
>
>
> --
> I could give you my word as a Spaniard.
> No good. I've known too many Spaniards.
> -- The Princess Bride
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: svn commit: r467331 - in /maven/plugins/trunk/maven-eclipse-plugin/src: main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java test/java/org/apache/maven/plugin/eclipse/MakeArtifactsTest.java
Posted by Carlos Sanchez <ca...@apache.org>.
I'm working on deploying parent and all plugins to central repository.
On 10/24/06, Fabrizio Giustina <fg...@gmail.com> wrote:
> Hi Carlos,
>
> On 10/24/06, carlos@apache.org <ca...@apache.org> wrote:
> > Author: carlos
> > Date: Tue Oct 24 06:36:54 2006
> > New Revision: 467331
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=467331
> > Log: > Use smaller groups and a parent pom for eclipse projects
>
> what is the benefit of having a parent pom? I would prefer keeping
> poms self-contained, an empty parent seems useless at the moment (all
> the values comes from the OSGI manifest).
>
> and what about the license that was added to the pom, now removed? Do
> you plan to deplo y a parent pom for that?
>
> fabrizio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
--
I could give you my word as a Spaniard.
No good. I've known too many Spaniards.
-- The Princess Bride
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: svn commit: r467331 - in /maven/plugins/trunk/maven-eclipse-plugin/src: main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java test/java/org/apache/maven/plugin/eclipse/MakeArtifactsTest.java
Posted by Carlos Sanchez <ca...@apache.org>.
I'm working on deploying parent and all plugins to central repository.
On 10/24/06, Fabrizio Giustina <fg...@gmail.com> wrote:
> Hi Carlos,
>
> On 10/24/06, carlos@apache.org <ca...@apache.org> wrote:
> > Author: carlos
> > Date: Tue Oct 24 06:36:54 2006
> > New Revision: 467331
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=467331
> > Log: > Use smaller groups and a parent pom for eclipse projects
>
> what is the benefit of having a parent pom? I would prefer keeping
> poms self-contained, an empty parent seems useless at the moment (all
> the values comes from the OSGI manifest).
>
> and what about the license that was added to the pom, now removed? Do
> you plan to deplo y a parent pom for that?
>
> fabrizio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
--
I could give you my word as a Spaniard.
No good. I've known too many Spaniards.
-- The Princess Bride
Re: svn commit: r467331 - in /maven/plugins/trunk/maven-eclipse-plugin/src: main/java/org/apache/maven/plugin/eclipse/MakeArtifactsMojo.java test/java/org/apache/maven/plugin/eclipse/MakeArtifactsTest.java
Posted by Fabrizio Giustina <fg...@gmail.com>.
Hi Carlos,
On 10/24/06, carlos@apache.org <ca...@apache.org> wrote:
> Author: carlos
> Date: Tue Oct 24 06:36:54 2006
> New Revision: 467331
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=467331
> Log: > Use smaller groups and a parent pom for eclipse projects
what is the benefit of having a parent pom? I would prefer keeping
poms self-contained, an empty parent seems useless at the moment (all
the values comes from the OSGI manifest).
and what about the license that was added to the pom, now removed? Do
you plan to deplo y a parent pom for that?
fabrizio
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org