You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by or...@io7m.com on 2015/08/08 18:04:09 UTC

Automatically appended artifactId in inherited SCM element

Hello.

I'm trying to reduce the redundancy of my existing POM files with
inheritance. I've run into an issue with the generated sites.

The parent pom:

  http://waste.io7m.com/2015/08/08/jnull.pom

A submodule pom:

  http://waste.io7m.com/2015/08/08/jnull-core.pom

The deployed site, note the correct URI for the source repository (not
actually uploaded to GitHub yet):

  http://waste.io7m.com/2015/08/08/staging/source-repository.html

Now note the incorrect URI in the submodule, because something is
appending the artifactId:

  http://waste.io7m.com/2015/08/08/staging/io7m-jnull-core/source-repository.html

Obviously, noone can clone the latter URI, as that's not how GitHub is
arranged. I don't want to have to redefine the SCM element in all of
the modules.

Any idea what's at fault here? How can I fix it?

M

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


Re: Automatically appended artifactId in inherited SCM element

Posted by or...@io7m.com.
On 2015-08-08T20:20:25 +0200
Karl Heinz Marbaise <kh...@gmx.de> wrote:

> Hi,
> 

Hello!

> The first thing which i saw where the wrong SCM connections given:

Corrected. I've actually switched to the https URIs, as those allow
anonymous cloning and authenticated pushes.

> Apart from that it would be helpfull to know which Maven version you are 
> using? How have you Maven called to generate the site ?

Apache Maven 3.3.3 (NON-CANONICAL_2015-07-27T12:38:38_root;
2015-07-27T09:38:38+00:00) Maven home: /opt/maven
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "4.0.7-2-arch", arch: "amd64", family: "unix"

According to rfscholte in the Freenode IRC channel, I'm running into
this known issue:

  https://issues.apache.org/jira/browse/MPIR-234

I've applied the workaround until it's fixed.

> The first thing i stumbled over was the ssh-extension you are defining? 
> So are you really trying to deploy via ssh your maven artifacts? Apart 
> from that why are you using such an old version? There are newer 
> versions available: http://maven.apache.org/wagon/

Right. I'm actually now just updating this project, which hasn't had
any kind of build updates since early 2012. I am deploying maven
artifacts to a privately hosted server over ssh, in addition to
deploying to Maven Central.

I've not found a way to avoid including that extension in the POM file
without having to edit the Maven super POM (changes to which will
obviously be wiped out every time I upgrade the OS package).

I'm using an old version simply because I haven't yet updated, and
nothing told me it was out of date.

> 
> Furthermore i have seen that you define plugins in your parent like this:
> ...
> Which should be done like this:

Fixed, thanks.

> which brings me to the next point you have defined the 
> maven-compiler-plugin in your jnull-core module like this:
> ...

OK.

> 
> And then you can remove the definition of this in every submodule...
> Also the definition of maven-jar-plugin which you did in the submodule 
> (jnull-core):
> ...
> 
> Should be done only in the parent only once within the pluginManagement 
> block...

OK.

> 
> See the docs of the archiver:
> http://maven.apache.org/shared/maven-archiver/index.html which is 
> referenced from the doc site of the maven-jar-plugin:
> https://maven.apache.org/plugins/maven-jar-plugin/jar-mojo.html
> 
> I have seen also that you define the maven-sources-plugin in your core 
> module like this:
> 
> Apart from the manifest part as mentioned for the maven-jar-plugin you 
> have defined explicit executions with binding to life cycle which is not 
> neccessary cause maven-sources-plugin is already bound to the life 
> cycle....And you should prevent using the goal 'jar' cause it will fork 
> the life cycle...Are you sure making source packages of your test code ?

I'm not sure what you mean here. I agree about the forking and didn't
actually realize I was still using those goals here (I switched to the
non-forking variants on my other projects and apparently missed this
one). I'm not sure what you mean by "Are you sure making source
packages of your test code?". I have always distributed four jars per
module in each of my projects: The sources jar, the compiled code jar,
the javadoc jar, and the test-sources jar.

> So i can give you a hint to read this:
> 
> http://blog.soebes.de/blog/2015/04/04/maven-prerequisites/

Right, I had no idea it was deprecated. I think it originally went in
because the versions plugin nagged me if I didn't use one.

M


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


Re: Automatically appended artifactId in inherited SCM element

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi,

On 8/8/15 6:04 PM, org.apache.maven.user@io7m.com wrote:
> Hello.
>
> I'm trying to reduce the redundancy of my existing POM files with
> inheritance. I've run into an issue with the generated sites.
>
> The parent pom:
>
>    http://waste.io7m.com/2015/08/08/jnull.pom
>
> A submodule pom:
>
>    http://waste.io7m.com/2015/08/08/jnull-core.pom
>
> The deployed site, note the correct URI for the source repository (not
> actually uploaded to GitHub yet):

The first thing which i saw where the wrong SCM connections given:


  <scm>
     <url>http://github.com/io7m/jnull</url>
     <connection>scm:git:git://github.com/io7m/jnull</connection>
 
<developerConnection>scm:git:git://github.com/io7m/jnull</developerConnection>
   </scm>


But they should like this:

  <scm>
     <url>http://github.com/io7m/jnull</url>
     <connection>scm:git:git://github.com/io7m/jnull.git</connection>
 
<developerConnection>scm:git:git://github.com/io7m/jnull.git</developerConnection>
   </scm>


Apart from that it would be helpfull to know which Maven version you are 
using? How have you Maven called to generate the site ?



>
>    http://waste.io7m.com/2015/08/08/staging/source-repository.html


I have taken a look at the two pom (parent)...

The first thing i stumbled over was the ssh-extension you are defining? 
So are you really trying to deploy via ssh your maven artifacts? Apart 
from that why are you using such an old version? There are newer 
versions available: http://maven.apache.org/wagon/

Furthermore i have seen that you define plugins in your parent like this:

   <build>
     <plugins>
       <!-- Plugin versions -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-clean-plugin</artifactId>
         <version>2.6.1</version>
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-deploy-plugin</artifactId>
         <version>2.8.2</version>
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-install-plugin</artifactId>
         <version>2.5.2</version>
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-resources-plugin</artifactId>
         <version>2.7</version>
       </plugin>
     </plugins>

Which should be done like this:

<build>
   <pluginManagement>
     <plugins>
       <plugin>..
       </plugin>...
     </plugins>
   </pluginManagement>
</build>

which brings me to the next point you have defined the 
maven-compiler-plugin in your jnull-core module like this:

  <build>
     <plugins>
       <!-- Require JDK >= 1.6 -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
         <version>3.3</version>
         <configuration>
           <source>1.6</source>
           <target>1.6</target>
         </configuration>
       </plugin>

So this should be done in the parent by this:

<build>
   <pluginManagement>
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
         <version>3.3</version>
         <configuration>
           <source>1.6</source>
           <target>1.6</target>
         </configuration>
       </plugin>
     </plugins>
   </pluginManagement>
</build>

And then you can remove the definition of this in every submodule...
Also the definition of maven-jar-plugin which you did in the submodule 
(jnull-core):

       <!-- Produce custom manifest in jar files -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
         <version>2.6</version>
         <configuration>
           <archive>
             <manifestEntries>
               <Specification-Title>${project.name}</Specification-Title>
 
<Specification-Version>${project.version}</Specification-Version>
               <Specification-Vendor>io7m.com</Specification-Vendor>
               <Implementation-Title>${project.name}</Implementation-Title>
 
<Implementation-Version>${project.version}</Implementation-Version>
               <Implementation-Vendor>io7m.com</Implementation-Vendor>
 
<Implementation-Vendor-Id>${project.groupId}</Implementation-Vendor-Id>
               <Built-By>io7m</Built-By>
               <Sealed>true</Sealed>
             </manifestEntries>
           </archive>
         </configuration>
       </plugin>

Should be done only in the parent only once within the pluginManagement 
block...Furthermore if i correctly see you define the manifiest with 
default entries which can be simplyfied by using this:

       <!-- Produce custom manifest in jar files -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
         <version>2.6</version>
         <configuration>
           <archive>
 
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
           </archive>
         </configuration>
       </plugin>

See the docs of the archiver:
http://maven.apache.org/shared/maven-archiver/index.html which is 
referenced from the doc site of the maven-jar-plugin:
https://maven.apache.org/plugins/maven-jar-plugin/jar-mojo.html

I have seen also that you define the maven-sources-plugin in your core 
module like this:

  <!-- Create source jar -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-source-plugin</artifactId>
         <version>2.4</version>
         <executions>
           <execution>
             <phase>package</phase>
             <goals>
               <goal>jar</goal>
               <goal>test-jar</goal>
             </goals>
             <configuration>
               <archive>
                 <manifestEntries>
 
<Specification-Title>${project.name}</Specification-Title>
 
<Specification-Version>${project.version}</Specification-Version>
                   <Specification-Vendor>io7m.com</Specification-Vendor>
 
<Implementation-Title>${project.name}</Implementation-Title>
 
<Implementation-Version>${project.version}</Implementation-Version>
                   <Implementation-Vendor>io7m.com</Implementation-Vendor>
 
<Implementation-Vendor-Id>${project.groupId}</Implementation-Vendor-Id>
                   <Built-By>io7m</Built-By>
                 </manifestEntries>
               </archive>
             </configuration>
           </execution>
         </executions>
       </plugin>

Apart from the manifest part as mentioned for the maven-jar-plugin you 
have defined explicit executions with binding to life cycle which is not 
neccessary cause maven-sources-plugin is already bound to the life 
cycle....And you should prevent using the goal 'jar' cause it will fork 
the life cycle...Are you sure making source packages of your test code ?



Also i have found a thing in your parent pom:

   <prerequisites>
     <maven>2.2.1</maven>
   </prerequisites>

So i can give you a hint to read this:

http://blog.soebes.de/blog/2015/04/04/maven-prerequisites/



Kind regards
Karl Heinz Marbaise

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