chocoteam / choco-solver

An open-source Java library for Constraint Programming
http://choco-solver.org/
BSD 4-Clause "Original" or "Old" License
688 stars 138 forks source link

Please publish the parent POM org.choco-solver:choco:4.10.3 #699

Closed thetric closed 4 years ago

thetric commented 4 years ago

Expected behavior

All choco dependencies can be resolved from Maven Central.

Actual behavior

Neither Gradle nor Maven are able to download org.choco-solver:choco-solver:4.10.3 because it Could not find artifact org.choco-solver:choco:pom:4.10.3 in central (https://repo.maven.apache.org/maven2). Gradle fails with:

> Could not resolve all files for configuration ':compileClasspath'.
   > Could not resolve org.choco-solver:choco-solver:4.10.3.
     Required by:
         project :
      > Could not resolve org.choco-solver:choco-solver:4.10.3.
         > Could not parse POM https://repo.maven.apache.org/maven2/org/choco-solver/choco-solver/4.10.3/choco-solver-4.10.3.pom
            > Could not find org.choco-solver:choco:4.10.3.
      > Could not resolve org.choco-solver:choco-solver:4.10.3.
         > Could not parse POM https://jcenter.bintray.com/org/choco-solver/choco-solver/4.10.3/choco-solver-4.10.3.pom
            > Could not find org.choco-solver:choco:4.10.3.

The POM of the 4.10.3 release contains an additional <parent> element which is not present in the 4.10.2 release:

Possible Solution

Steps to Reproduce (for bugs)

Maven:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>choco4-10-3-bug</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>org.choco-solver</groupId>
            <artifactId>choco-solver</artifactId>
            <version>4.10.3</version>
        </dependency>
    </dependencies>
</project>

Perhaps you have to remove the choco files from your local .m2 to reproduce this issue.

Context

I've tried update from 4.10.2 to 4.10.3.

Environment

mrattfeldt commented 4 years ago

Bump

JiiTee commented 4 years ago

Needed here too. Please and thank you!

glelouet commented 4 years ago

I am also affected by this.

Strange thing is, the 4.10.3 is present in https://repo1.maven.org/maven2/org/choco-solver/choco-solver/4.10.3/

So I thought I made a mistake, but it seems I'm not the only one affected.

cprudhom commented 4 years ago

I migrated the project to a multi-module one (following those steps: baeldung.com/maven-multi-module). But, it appears that org.choco-solver:choco:4.10.3 was not released on MCR. I'll try to fix that quickly.

fbl100 commented 4 years ago

Has this been resolved? We were using a 4.10.3-SNAPSHOT dependency, but sometime in the last 24 hours it disappeared. I Tried updating to 4.10.3 and got this error.

Updating to 4.10.4-SNAPSHOT worked for me, but I would prefer to depend on the 4.10.3 release.

cprudhom commented 4 years ago

I plan to release in a couple of hours, but I'm not sure of the fix.

cprudhom commented 4 years ago

I belive the patch does not do the job...

glelouet commented 4 years ago

do you know what the problem is ?

cprudhom commented 4 years ago

Not really, but as a fisrt step I tried to (lightly) revamp pom.xml files wrt to your PR. It seemed to work but I tried to install choco in a docker image (ie, in a fresh new environment), and I got an error related o JPMS.

cprudhom commented 4 years ago

AFAIK, the last commit (e11dabf337784c82f1944d16f440fbc16493faf0) which reverts pom.xml, fix the issue I encountered. I'm still unable to dry-run the release process, so I'm not sure the parent POM will be published... But I will try now.

glelouet commented 4 years ago

you can install in a temp dir to test the creation of the artifacts.

# go in temp dir 
cd $(mktemp -d)
# create local repo
mkdir repo
# clone choco. you can add -b <branch> at the end if you want to test a specific branch
git clone https://github.com/chocoteam/choco-solver.git
# go in choco dir
cd choco-solver
# run maven install . need a absolute path for the maven.repo.local
mvn install -Dmaven.repo.local=$(pwd)/../repo/ -DskipTests 
# go make a coffee, since maven will download half of internet
# check the result 
tree ../repo/org/choco-solver/

https://imgur.com/c0kMyEW

glelouet commented 4 years ago

personally I stopped using the release goal in maven because it's just a pain. I manually update the root pom value with

version=a.b.c
mvn versions:set -DnewVersion=$version
mvn deploy
git commit -am "v$version"
git tag  "v$version"
git push && git push --tags
cprudhom commented 4 years ago

The release went well, it is only a matter of time before MVN will be updated. 🤞

cprudhom commented 4 years ago

It seems to be ok, the parent POM is available: https://repo.maven.apache.org/maven2/org/choco-solver/choco/4.10.4/

mrattfeldt commented 4 years ago

Did anyone here manage to upgrade to 4.10.4? I get the following exception when Choco kicks in:

java.lang.IllegalAccessError: class org.chocosolver.solver.constraints.nary.sat.PropSat tried to access field org.chocosolver.sat.SatSolver.ok_ (org.chocosolver.solver.constraints.nary.sat.PropSat and org.chocosolver.sat.SatSolver are in unnamed module of loader 'app')

    at org.chocosolver.solver.constraints.nary.sat.PropSat.propagate(PropSat.java:100)
    at org.chocosolver.solver.propagation.PropagationEngine.execute(PropagationEngine.java:225)
    at org.chocosolver.solver.propagation.PropagationEngine.activatePropagators(PropagationEngine.java:209)
    at org.chocosolver.solver.propagation.PropagationEngine.propagate(PropagationEngine.java:173)
    at org.chocosolver.solver.search.loop.propagate.PropagateBasic.execute(PropagateBasic.java:46)
    at org.chocosolver.solver.Solver.initialize(Solver.java:367)
    at org.chocosolver.solver.Solver.solve(Solver.java:255)
cprudhom commented 4 years ago

This is a JPMS issue, so I suppose you are using Java 9+ ? To be honest, I don't understand what is going on. The ok_ field is public , and module-info.java of org.chocosolver.sat exports org.chocosolver.sat to org.chocosolver.solver. Jar files are doubly compiled, as depicted in Apache Maven Compiler Plugin website

mrattfeldt commented 4 years ago

I run Java 11, but I can trigger this also with Java 8. The problem is triggered for example by this model: https://www.cosling.com/choco-solver/pareto

Would you like a stand-alone bug report?

cprudhom commented 4 years ago

Would you like a stand-alone bug report? Yes, that would be easier, but you can refer to this issue.